App gets terminated when VoIP push is received when app in background

Our app gets terminated when an incoming call is received when app is in the background.

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

Xcode - 11.3
iPhone - SE (13.3.1)

Hello @Ajay_Nagwani

when received ringing event, you have to call ‘provider.reportNewIncomingCall()’ on the same thread.
https://developer.apple.com/documentation/pushkit/pkpushregistrydelegate/2875784-pushregistry

Important

On iOS 13.0 and later, if you fail to report a call to CallKit, the system will terminate your app. Repeatedly failing to report calls may cause the system to stop delivering any more VoIP push notifications to your app. If you want to initiate a VoIP call without using CallKit, register for push notifications using the UserNotifications framework instead of PushKit. For more information, see UserNotifications.

Thanks,

I’ve already reported a call. Can you please help me where am I wrong?

func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
// MARK: Handling incoming call
SendBirdCall.pushRegistry(registry, didReceiveIncomingPushWith: payload, for: type) { uuid in
guard uuid != nil else {
let update = CXCallUpdate()
let randomUUID = UUID()
update.remoteHandle = CXHandle(type: .generic, value: “invalid”)
CXCallManager.shared.reportIncomingCall(with: randomUUID, update: update) { error in
CXCallManager.shared.endCall(for: randomUUID, endedAt: Date(), reason: .acceptFailed)
}
completion()
return
}
completion()
}
}

If ‘SendBirdCall.pushRegistry()’ is handled normally, ‘SendBirdDelegate.didStartRinging’ is called from the same thread. You have to call the method there.

thanks

Please refer to quickstart example code.

We’ve referred this code. Our app gets crashed in following method:
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void)

with 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 callback.'