CallKit prevent PushKit from being called

584 Views Asked by At

I'm using PushKit and CallKit in my iOS app for sending and receiving calls. My problem is that when app is killed and I receive a call, didReceiveIncomingPushWith is called and I display a native call screen using the line

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

But once this line is called and native call screen appeared, in case of caller cancel the call, didReceiveIncomingPushWith is never called again.

What is strange is that if I commented this line

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

didReceiveIncomingPushWith is being called perfectly.

Does anyone have any explanation/solution?

Edit

I'm using XMPP server which has a socket open, in case I close this socket in didReceiveIncomingPushWith method it worked (but causes another issue that I couldn't answer as there connection is lost).

1

There are 1 best solutions below

2
On

Whenever you cancel a call/terminal always invoke and tell the system that call has been changed his state with this method.

Objective-C

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

Swift

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