Enable Push Notifications on iOS

After you integrate and configure the SDK, enable push notifications in your iOS app. This process involves enabling push capabilities in Xcode, implementing the required delegate protocols, and registering for remote notifications.

  1. In Xcode, on the Signing & Capabilities tab for your app, enable push notifications.

  2. Set your AppDelegate class to adhere to the UIApplicationDelegate and UNUserNotificationCenterDelegate protocol.

  3. Extend the SDK configuration code to add support for push registration.

    Code example for version 10 and later

    If your app uses version 10 or later of the SDK, use this code.

    Code example for version 8 and 9 If your app uses version 8 or 9 of the SDK, use this code.
    Code example for version 7 This code example shows how to configure the version 7 of the SDK for iOS apps.
  4. Add the required UIApplicationDelegate protocol methods to support push registration to your AppDelegate class.

    Code example for version 10 and later

    If your app uses version 10 or later of the SDK, use this code.

    Code example for version 8 and 9

    If your app uses version 8 or 9 of the SDK, use this code.

    Code example for version 7

    If your app uses version 7 of the SDK, use this code.

  5. Add the required UNUserNotificationCenterDelegate protocol methods to support push notifications to your AppDelegate class.

    Code example for version 10 and later

    If your app uses version 10 or later of the SDK, use this code.

    Code example for version 9

    If your app uses version 9 of the SDK, use this code.

    Code example for version 8

    If your app uses version 8 of the SDK, use this code.

    Code example for version 7

    If your app uses version 7 of the SDK, use this code.

The delegate methods in this procedure use Marketing Cloud SDK APIs to manage push notifications, contact registration, and analytics tracking. If you implement the delegate methods without calling the corresponding SDK methods, these features don’t work.