I am developing VOIP feature using PushKit and CallKit but CallKit is not showing when app in background or terminate state, now in foreground state I can call reportNewIncomingCall from pushRegistry-didReceiveIncomingPushWith and it's working as expected but the problem is in background or terminate state it's not
So, there are a few things that can happen here:
-
If you've just gotten this working, it's pretty common that you failed the call report requirement "enough" times that the system stopped delivering new pushes. To reset that count, delete the app completely, turn the device off, turn it back on, then reinstall. Note that while the full restart is not specifically required, I recommend doing it any time you need to be SURE things have reset properly.
-
Your app should include the "audio" background category as well as "voip". There are weird entanglements between CallKit and the audio system that make CallKit "work" even without "audio", however, that behavior isn't really intentional and I've seen weird problems in apps that forgot to include "audio". You need to include both.
-
If PushKit/CallKit are working in the foreground then that generally validates that your push infrastructure is working, however, you can also validate that "fully" by testing with our Speakerbox sample. Speakerbox effectively implements a "full" voip app implementation (including PushKit)... except it doesn't actually do ANY networking (effectively, it's a fake calling app).
Assuming all of that works properly, then the problem is almost certainly a bug in your app. The exact details vary, but the common cases are:
-
The app assumes the user will always log in when the app launches, which breaks when the app is launched into the background.
-
The app does NOT in fact immediately report every incoming call to CallKit as the API contract requires.
-
The app assumes data will be available when it isn't, particularly in the case where the app is relaunched on a locked device immediately after reboot ("Prior to first unlock").
My basic recommendation here is that you need to completely validate your call handling code before you try and look for any external factor. There should not be ANY path through your PushKit delegate that does not ALWAYS report a call. Similarly, PushKit and CallKit should both be set up early in the launch process and left active for your app’s entire lifetime.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware