iOS 15 issues with background VoIP notifications

I was doing some searching trying to get some answers on what could be causing this issue and saw an answer that said to use a serial queue to get past this issue. I am using a serial queue but still facing issues with getting VoIP notifications to come through while app is in background or in a killed state. While it is in the foreground everything runs great and as expected. I referred to this documentation and a post on here about the serial queue.

https://developer.apple.com/documentation/pushkit/pkpushregistry/1614494-init

(In the Parameters section it very briefly states that you need a serial queue).

Any help would be much appreciated. The most difficult part is that there aren't any logs for me to follow on this issue.

Here is relevant code

var voipRegistry = PKPushRegistry.init(queue: DispatchQueue(label: "voipQueue"))

self.pushKitEventDelegate = notificationHandler
self.voipRegistry.delegate = self
self.voipRegistry.desiredPushTypes = [PKPushType.voIP]

Relevant outputs:

-Running from foreground

pushRegistry:didReceiveIncomingPushWithPayload:forType:completion:

-Running from background

-Running from Killed state

Answered by javyduty in 742197022

In case anyone else is banging their head against a wall with this. I will provide my solution. It seems that voip notifications need to report to call kit within seconds so it has to be done right away. I was using an API call to get the call details first and then reporting the call. This will cause an error to show up that says the same thing I just explained. If you keep sending notifications without reporting right away after about 4 times Apple will block the notifications from coming in. From your notification server you will see 200 success but nothing on the app side. I had to delete the app and install again to see the error message again, then reporting the call to CallKit right after seems to work. Background and killed state. I did use a serial queue (not main). Good luck to anyone else out there facing this issue as the threads are bare bones on answers. Hope this helps.

Accepted Answer

In case anyone else is banging their head against a wall with this. I will provide my solution. It seems that voip notifications need to report to call kit within seconds so it has to be done right away. I was using an API call to get the call details first and then reporting the call. This will cause an error to show up that says the same thing I just explained. If you keep sending notifications without reporting right away after about 4 times Apple will block the notifications from coming in. From your notification server you will see 200 success but nothing on the app side. I had to delete the app and install again to see the error message again, then reporting the call to CallKit right after seems to work. Background and killed state. I did use a serial queue (not main). Good luck to anyone else out there facing this issue as the threads are bare bones on answers. Hope this helps.

Follow up, if anyone is having issues when implementing a voip solution and you notice that the call doesn't work when the phone is in the locked screen state but when the device is locked it works look no further. Again I have dealt with this issue and it involves CallKit. If you initiate a call in CallKit but it doesn't have an audio configuration before it actually passes the call then you will not have audio and most VOIP solutions will drop the call. To solve this, simply configure the audio before sending the call to CallKit. So when a call comes through as a VOIP notification configure the audio before calling the "reportNewIncomingCall" function. Hope this helps, Cheers!

I have the same problem. When I send a push notification twice in a row, I receive it. However, when I send only one push notification and the app is in the background, I do not receive the push notification! I don't know how to solve this.

iOS 15 issues with background VoIP notifications
 
 
Q