Update iOS

This page explains how to upgrade the native iOS SDK to version 2.11. While these changes aren’t breaking—you don’t need to make these changes—they will simplify your integration and improve the reliability of your metrics and deep link handling on iOS devices.

Upgrade native iOS SDK to 2.11+

As of version 2.11, the native iOS Customer.io SDK automatically handles push clicks. These features simplify your SDK integration while improving the reliability of opened metrics tracking and increasing compatibility with other push modules you may have installed in your app.

  1. Follow our native iOS update guide to update the Flutter and iOS SDK to use the latest version.

  2. Open your AppDelegate file and review all of the highlighted code below in this sample.

      import Flutter
      import CioMessagingPushFCM
      import CioTracking
      import FirebaseMessaging
      import FirebaseCore 
      import UserNotifications 
    
      class AppDelegate: FlutterAppDelegate {
      func application(
       _ application: UIApplication,
       didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
      ) -> Bool {
       ...
    
       // Delete this line of code: 
       UNUserNotificationCenter.current().delegate = self
    
       return super.application(application, didFinishLaunchingWithOptions: launchOptions)
     }
    
     ...
      
      // Delete this function: 
      override func userNotificationCenter(
       _ center: UNUserNotificationCenter,
       didReceive response: UNNotificationResponse,
       withCompletionHandler completionHandler: @escaping () -> Void
      ) {
       // Call the Customer.io SDK to handle the push notification
       let handled = MessagingPush.shared.userNotificationCenter(center, didReceive: response,
                                                                 withCompletionHandler: completionHandler)
    
       // If the Customer.io SDK does not handle the push, it's up to you to handle it and call the
       // completion handler. If the SDK did handle it, it called the completion handler for you.
       if !handled {          
           completionHandler()
       }
     }
    
     // Delete this function: 
     func userNotificationCenter(
       _ center: UNUserNotificationCenter,
       willPresent notification: UNNotification,
       withCompletionHandler completionHandler: **@escaping** (UNNotificationPresentationOptions) -> Void
     ) {
       completionHandler([.list, .banner, .badge, .sound])
     }
      }
  3. Now that your app’s code has been simplified, it’s time to enable these new SDK features.

To do this, you’ll need to initialize the MessagingPush module. Follow the latest push notification setup documentation to learn how to do this.

Copied to clipboard!
  Contents
Current release
 1.4.0
Is this page helpful?
Chat with AI