【问题标题】:CallKit prevent PushKit from being calledCallKit 防止 PushKit 被调用
【发布时间】:2018-09-19 10:46:03
【问题描述】:

我在我的 iOS 应用程序中使用 PushKit 和 CallKit 来发送和接收呼叫。 我的问题是,当应用程序被杀死并且我接到一个电话时,didReceiveIncomingPushWith 被调用,我使用该行显示一个本机通话屏幕

provider.reportNewIncomingCall(with: currentCallID, update: update, completion: { error in })

但是一旦调用此线路并出现原生调用屏幕,如果调用者取消调用,didReceiveIncomingPushWith 将不再调用。

奇怪的是,如果我评论了这一行

provider.reportNewIncomingCall(with: currentCallID, update: update, completion: { error in })

didReceiveIncomingPushWith 被完美调用。

有人有任何解释/解决方案吗?

编辑

我正在使用打开套接字的 XMPP 服务器,以防我在 didReceiveIncomingPushWith 方法中关闭此套接字,它可以工作(但会导致另一个问题,由于连接丢失,我无法回答)。

【问题讨论】:

  • 你调用提供的完成处理程序吗?
  • 是的,我打电话给completion() didReceiveIncomingPushWith
  • 因为你没有调用 endCall 方法。
  • 我必须收到来电者已取消的通知才能调用 endCall
  • 在收到来自PushKit 的通知并显示本地通话屏幕后,您应该连接您的套接字,当您通过套接字而不是PushKit 收到取消/结束通话通知时。只需调用reportCall 和densureElseWhere 并关闭您的来电屏幕。这将使您的工作更加轻松。

标签: ios iphone callkit pushkit


【解决方案1】:

每当您取消呼叫/终端时,始终调用并告诉系统呼叫已使用此方法更改了他的状态。

目标-C

[provider reportCallWithUUID: currentCallID endedAtDate:endingDate reason:(CXCallEndedReasonDeclinedElsewhere)];

斯威夫特

provider.reportCall(with: currentCallID, endedAt: endingDate, reason: .declinedElsewhere)

【讨论】:

  • 是的,但我必须从系统中得知呼叫者已结束通话(在我接听之前)。但是didReceiveIncomingPushWith 没有被调用!
  • 不,我切换到使用你提到的打开的套接字连接。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-06
  • 1970-01-01
  • 2013-07-15
  • 2015-04-23
  • 2017-06-07
  • 1970-01-01
相关资源
最近更新 更多