Search code examples
swiftpushvoipios13callkit

With iOS13, is it allowed to report CXCallUpdate or CXEndCallAction when a VoIP Push is received?


I wonder if is it allowed to report CXCallUpdate or CXEndCallAction inside the method below when a VoIP Push is received.

func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, forType type: PKPushType) {
  // report new incoming call
}

Official documentation just mentions reporting newNewIncomingCall here in that block. HEre is relevant part of the documentation.

When linking against the iOS 13 SDK or later, your implementation of this method must report notifications of type voIP to the CallKit framework by calling the reportNewIncomingCall(with:update:completion:) method of your app's CXProvider object.

Thanks in advance for your help.


Solution

  • It seems that the relevant document which describes how a VoIP push should be handled is just updated on the official Apple documentation website.

    It says don't send any other VoIP push to the application other than an incoming call which means we can not report CXCallUpdate or CXEndCallAction once a VoIP push is received.

    The relevant part of the document can be seen below

    After sending the initial push notification, don’t send additional push notifications to cancel the call or communicate new details to your app. Instead, communicate with the app directly over the network connection you established between it and your server. Using an existing network connection is generally faster than sending a push notification, and if network conditions are poor, APNs may be unable to deliver push notifications to the device anyway.

    Here is also official documentation which is just updated

    https://developer.apple.com/documentation/pushkit/responding_to_voip_notifications_from_pushkit?language=objc