Search code examples
iosswiftapple-push-notificationsvoippushkit

Testing VoIP push messages - messages only arrive in-app


I have a very simple PHP test script that initially works, using the following server config:

$domain = "gateway.sandbox.push.apple.com";
$url = 'ssl://' . $domain . ':2195';

I'm receiving PushKit notifications every time I expect them including when the phone is locked. However testing it over and over while trying to implement the server side and convert it to HTTP/2, it just stops working reliably and only seems to trigger when I'm inside the application.

Inside the application: always works Outside of the application including just backgrounded the app: works in the beginning, then stops working

It's very hard to get it to work if I don't know if even the most basic form of sending the message (through the PHP test script works). Also it worries me that my production application might suffer from the same kind of throttling if a user is sending too many messages (i.e. mom trying to call from the hospital 10x in a row).

I do always trigger CallKit in my PushKit code path every time so I think I'm good regarding to the changes in VoIP pushes in iOS 13.

What could be the cause of this different over time? How (if possible) can I prevent it? How can I detect it?


Solution

  • For that one person that upvoted my question but didn’t find a response:

    Killing the app makes the OS think depriotitize it and it leads to the OS not forwarding the VoIP push anymore. To mitigate this problem as a developer you need to start the debugger without launching the app, so when you open the app from the push it can attach. Then kill the app only through the stop button in Xcode.

    Testers need to be instructed about this problem. If you’re sure the code works for you and it stops working for the tester, they need to uninstall the app, restart the phone and install it again. If possible never kill the app manually. This sucks, I know it.