Reputation: 782
I have already developed a VOIP call app that uses pushkit for VOIP push notification. Our notification server is designed to deliver all cancel notifications along with new incoming call notifications through VOIP push (This behavior can't be changed as of now). Since it has become mandatory to report all incoming push notifications to callkit after the iOS 13 release. There are scenarios where I am not able to report the cancel PUSH notification to callkit which ultimately result in app crash
Scenario:
If the user rejects the incoming call PUSH notification (i.e. basically rejecting the incoming call), the notification server delivers a cancel PUSH notification just after that. But since the new incoming call has already been rejected and there is no active callId to report, there is no way to report the cancel PUSH notification to callkit. So, failure to report the cancel push results in in-app crash. This does happen in all those where there is no active/pending call and the client the PUSH for cancel notification.
Please help me out with how to handle this scenario.
Upvotes: 3
Views: 2009
Reputation: 1686
As you've said: starting from iOS 13 it has become mandatory to report a new incoming call for every VoIP push received.
There's no way around that. If you can't change the behavior of your server, the only thing you can do to avoid a crash (and the blocking of subsequent VoIP pushes delivery) is to report a fake call to make PushKit happy and immediately terminate it.
let callId = UUID()
cxProvider.reportNewIncomingCall(
with: callId,
update: callUpdate,
completion: { [weak self] error in
completion()
self?.cxProvider.reportCall(with: callId, endedAt: nil, reason: .failed)
})
Upvotes: 2