' nsinternalInconSistencyException',原因:' killing应用程序,因为它在收到Pushpekit voip推送后从未发布过对系统的来电

发布于 2025-02-05 06:20:01 字数 1351 浏览 3 评论 0原文

无法解决这个问题尝试了很多事情。尝试调试,但一直显示此错误

***终止应用程序由于未被发现的例外“ nsinternalInconSistencyException”,原因:'杀死应用程序,因为它在收到PushTkit voip push后从未发布过对系统的传入呼叫。'

func pushRegistry(_ registry: PKPushRegistry,didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
    let dict = payload.dictionaryPayload
    if let handleDict = dict["handle"] as? NSDictionary {
        self.callDict = handleDict
        
        let config = CXProviderConfiguration(localizedName: "App")
        config.iconTemplateImageData = UIImage(named: "user_circle")!.pngData()
        config.ringtoneSound = "iphoneRingtone.mp3"
        config.includesCallsInRecents = true;
        config.supportsVideo = true;
        
        let callProvider = CXProvider(configuration: config)
        callProvider.setDelegate(self, queue: nil)
        
        let callUpdate = CXCallUpdate()
        let phoneNumber = CXHandle(type: .phoneNumber, value: "SoCircle")
        callUpdate.remoteHandle = phoneNumber
        callUpdate.hasVideo = true
        let callUUID = UUID()
        
        // Report the call to CallKit
        callProvider.reportNewIncomingCall(with: callUUID, update: callUpdate, completion: { (error) in
            completion()
        })
    }
    completion()
}

Unable to resolve this issue tried many things. Tried debugging but it keeps showing this error

*** 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.'

func pushRegistry(_ registry: PKPushRegistry,didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
    let dict = payload.dictionaryPayload
    if let handleDict = dict["handle"] as? NSDictionary {
        self.callDict = handleDict
        
        let config = CXProviderConfiguration(localizedName: "App")
        config.iconTemplateImageData = UIImage(named: "user_circle")!.pngData()
        config.ringtoneSound = "iphoneRingtone.mp3"
        config.includesCallsInRecents = true;
        config.supportsVideo = true;
        
        let callProvider = CXProvider(configuration: config)
        callProvider.setDelegate(self, queue: nil)
        
        let callUpdate = CXCallUpdate()
        let phoneNumber = CXHandle(type: .phoneNumber, value: "SoCircle")
        callUpdate.remoteHandle = phoneNumber
        callUpdate.hasVideo = true
        let callUUID = UUID()
        
        // Report the call to CallKit
        callProvider.reportNewIncomingCall(with: callUUID, update: callUpdate, completion: { (error) in
            completion()
        })
    }
    completion()
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷乱花海 2025-02-12 06:20:01

您遇到错误的主要原因有两个。

  1. 您可能知道,在接收VoIP推送时,您始终必须报告一个新的来电。如果出于任何原因,dict [“ hander”]nil或不是nsdictionary新的来电,因此您会收到错误。

  2. 完成()才能在成功报告新传入的呼叫后才调用,因此在report> report> report> ReportnewincomingCall的完整处理程序中。问题是您在之外调用 的position()。鉴于reportnewincomingCall是一种异步方法,postemion() 外部如果在 之前,请在report> report> report> report> report> report>完成后,系统将认为您未能报告新的来电。因此,只需删除外部 外删除。

There are two main reasons why you get that error.

  1. As you may know, you always have to report a new incoming call when receiving a VoIP push. If, for any reason, the value contained in dict["handle"] is nil or is not an NSDictionary, you fail to report a new incoming call and so you get the error.

  2. The completion() should be called only after you successfully reported a new incoming call, so inside the completion handler of reportNewIncomingCall as you've done. The problem is the completion() that you call outside the if. Given that reportNewIncomingCall is an asynchronous method, the completion() outside the if will be called before the reportNewIncomingCall has completed, hence the system will think that you've failed to report a new incoming call. So, just remove the completion() outside the if.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文