' nsinternalInconSistencyException',原因:' killing应用程序,因为它在收到Pushpekit voip推送后从未发布过对系统的来电
无法解决这个问题尝试了很多事情。尝试调试,但一直显示此错误
***终止应用程序由于未被发现的例外“ 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您遇到错误的主要原因有两个。
您可能知道,在接收VoIP推送时,您始终必须报告一个新的来电。如果出于任何原因,
dict [“ hander”]
是nil
或不是nsdictionary
新的来电,因此您会收到错误。report> report> report> ReportnewincomingCall
的完整处理程序中。问题是您在之外调用 的position()
。鉴于reportnewincomingCall
是一种异步方法,postemion()
外部如果在 之前,请在report> report> report> report> report> report>完成后,系统将认为您未能报告新的来电。因此,只需删除
外部 外删除。There are two main reasons why you get that error.
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"]
isnil
or is not anNSDictionary
, you fail to report a new incoming call and so you get the error.The
completion()
should be called only after you successfully reported a new incoming call, so inside the completion handler ofreportNewIncomingCall
as you've done. The problem is thecompletion()
that you call outside theif
. Given thatreportNewIncomingCall
is an asynchronous method, thecompletion()
outside theif
will be called before thereportNewIncomingCall
has completed, hence the system will think that you've failed to report a new incoming call. So, just remove thecompletion()
outside theif
.