首页 > 解决方案 > 当应用程序处于非活动终止状态时,带有 CallKit 的 VOIP 通知不会调用 reportIncomingCall

问题描述

这是一个视频通话应用程序。我已经实施了 VoIP 通知来接收视频通话。在收到 VoIP 通知时,我正在使用 CallKit 拨打电话reportNewIncomingCall()

当我最小化应用程序时,我收到来电并且流程正常。但是当我杀死应用程序时,我没有接到来电。知道为什么吗?我还注意到,当我下次点击并打开应用程序时,它会崩溃:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push callback.'

这表示我没有发布reportNewIncomingCall。但是我已经在做它并在应用程序最小化时接到电话。

func pushRegistry(_ registry: PKPushRegistry,
                  didReceiveIncomingPushWith payload: PKPushPayload,
                  for type: PKPushType,
                  completion: @escaping () -> Void) {

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

只有在被杀死的状态下,我没有接到电话。要在终止状态下接听电话,还需要做什么?请帮忙。

标签: iosnotificationsvoipcallkitpushkit

解决方案


您是否尝试在完成处理程序中调用pushRegistry完成处理reportNewIncomingCall程序?

func pushRegistry(_ registry: PKPushRegistry,
                  didReceiveIncomingPushWith payload: PKPushPayload,
                  for type: PKPushType,
                  completion: @escaping () -> Void) {

    provider.reportNewIncomingCall(with: uuid, update: update) { error in
        completion() // <----
    }
}

即使文档中不清楚,我认为这是处理新来电的正确方法。


推荐阅读