iOS 13 Migration Guide

    Overview

    In iOS 13 and later versions, Apple is introducing changes in push notification handling. If your application supports incoming calls via push notification on iOS devices, your application will be impacted by these changes. This migration guide will help you upgrade your iOS applications to support the new PushKit push notification policy.

    Apple’s PushKit push notification policy changes

    The new policy mandates that apps built using Xcode 11 and running on iOS 13 devices must report all PushKit push notifications to CallKit in the same run loop. Failure to do so will result in iOS 13 terminating your app. The system will stop delivering any more push notifications to your app.

    For more detail, refer to Apple’s documentation on the new PushKit push notification policy and WWDC’19 talk.

    Apps Impacted

    If you built your apps with Xcode 11, and have support for incoming calls via push notifications, you must migrate to Plivo iOS SDK version 2.1.12 or later. Follow this guide to migrate your setup. Existing apps built using Xcode 10 or lower and running on iOS 13 will not be impacted by these changes.

    Steps to Migrate

    If your apps are impacted by these changes, complete the following steps to comply with the new policy:

    1. Upgrade to Plivo iOS SDK 2.1.12 or later.
    2. Next, any push notifications received need to be reported to CallKit in the same run loop. Change your push notification handling to dispatch the relayVoipPushNotification method synchronously in didReceiveIncomingPushWith. This method will internally call onIncomingCall delegate where CallKit will be notified.

       func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
           NSLog("pushRegistry:didReceiveIncomingPushWithPayload:forType:")
           if (type == PKPushType.voIP) {
               Phone.sharedInstance.relayVoipPushNotification(payload.dictionaryPayload)
           }
       }
      
    3. Implement OnIncomingCallAnswered delegate which will be fired only when the call is answered and Audio is ready to flow.

       func onIncomingCallAnswered(_ incoming: PlivoIncoming) {
           print("- Incoming call answered");
           print("Call id in incoming answered is:")
           print(incoming.callId)
           isIncomingCallAnswered = true
       }
      
    4. Implement OnIncomingCallInvalid delegate which will be fired if any of the following events occur:
      • The callee does not accept or reject the call within 40 seconds.
      • SDK is not able to establish a connection with Plivo.
       func onIncomingCallInvalid(_ incoming: PlivoIncoming) {
           print("- Incoming call is invalid");
           print("Call id in incoming call invalid is:")
           print(incoming.callId)
           if (incCall != nil) {
               self.isItUserAction = true
               performEndCallAction(with: CallKitInstance.sharedInstance.callUUID!, isFeedback: true)
               incCall = nil
           }
           callSubmitFeedbackUI()
       }
      

    You can refer to our Example iOS App for more help while migrating your app.