iOS 13 Migration Guide

Overview

In iOS 13 and later versions, Apple introduced 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 helps 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 2019 talk.

Apps Impacted

If you built your apps with Xcode 11, and support 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 are not impacted by these changes.

Steps to Migrate

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

  1. Upgrade to Plivo iOS SDK 2.1.12 or later.
  2. 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 internally calls the onIncomingCall delegate, where CallKit is 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 the 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 the OnIncomingCallInvalid delegate, which will be fired if either:
    • The call recipient doesn’t accept or reject the call within 40 seconds.
    • The SDK is unable 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 Plivo Voice Quickstart example iOS app as you migrate your app.