SDK: Swift / Obj-C

The iOS (Swift / Obj-C) SDK is currently in closed beta. Contact your account manager for more information on becoming a beta partner.


Before you can integrate the SDK with your app the following requirements must be met:

  • An iOS 11+ device (iPhone, iPad, or iPod Touch) to develop and test on.

    • Note: The XCode Simulator does not support remote push notifications. A physical device must be used.

  • A Mac OS device with XCode 14+ (Swift 5.7, if using Swift) installed.

  • An iOS P12 Push Certificate or P8 Key. If you do not already have these follow our documentation to generate them.

  • SDK Key: Obtained from the Pushly Platform in the Domain Settings page under the Overview > Details > Domain Information section.

Step 1: Import the PushSDK Framework

The PushSDK Framework is compatible with both Swift and Objective-C.

  • Select the root project and then your primary application target > General

  • Click + > Add Other > Add Package Dependency under Frameworks, Libraries, and Embedded Content

  • Search using the Package URL:

  • Set the Dependency Rule to: Range of Versions and 1.0.0 < 2.0.0

  • Click Add Package

  • Ensure the Pushly option is checked and click Add Package

  • Finally, add the Pushly library to the Primary Application Target

Step 2: Add the Notification Service Extension

The Notification Service Extension is required to enable rich notifications that support images and custom actions.

Within your app's XCode project select File > New > Target. Select Notification Service Extension inside the iOS templates tab and click Next.

Enter "NotificationServiceExtension" for the Product Name and any other configuration details for your app extension and then click Finish but do not click activate on the subsequent dialog.

Click Cancel on the dialoging prompting you to activate the service extension so that you can set the deployment target once the modal is closed.

Make sure to set your deployment target to the same as your primary application target. Unless you have a specific reason not to, you should set the Deployment Target to be iOS 11 which is the lowest supported version of iOS in the PushSDK Framework and in the most recent releases of XCode.

Next, add the Pushly library to your Notification Service Extension:

Click + under Frameworks and Libraries and select the already imported Pushly library.

Now, open the newly created Notification Service Extension and replace the code with the following:

import Pushly

class NotificationService: PNNotificationServiceExtension {

You can ignore dependency errors, such as Module Pushly not found, at this point as they will be resolved during the next build.

Step 3: Add Capabilities to Primary Application Target

The Push Notifications capability should only be added to the primary application target.

Select the root project and then your primary application target > Signing & Capabilities

Click the + Capability and add Push Notifications.

Click the + Capability and add Background Modes.

After adding the Background Modes capability ensure that Remote Notifications are enabled.

Click the + Capability and add App Groups.

Click the + symbol located inside the App Groups section to add a new named container. To ensure that the PushSDK can properly capture information the container should be named group.{app-bundle-id}.push.

Check the box next to the newly created App Group in the primary application target.

If Xcode complains about the new app group at this point you may need to refresh the list after it is done provisioning.

Step 4: Add Capabilities to The Notification Service Extension

Select the root project and then the NotificationServiceExtension > Signing & Capabilities

Click the + Capability and add App Groups.

Finally, check the box next to the newly created App Group in the NotificationServiceExtension.

Step 5: SDK Initialization

First import the Pushly library in your AppDelegate

import Pushly

Add the following code to the AppDelegate's didFinishLaunchingWithOptions method of your application.

Replace the REPLACE_WITH_SDK_KEY in the setConfiguration method with the SDK Key from the platform settings page.

PushSDK.logLevel = .info
PushSDK.setConfiguration(appKey: "REPLACE_WITH_SDK_KEY", withLaunchOptions: launchOptions)

PushSDK.PushNotifications.showPermissionPrompt() { granted, settings, error in
    // optional callback
    print("User accepted permissions: \(granted)")

Step 6: Test the Implementation

Run your app on a physical iOS device to make sure it builds correctly.

Note: The XCode Simulator does not support remote push notifications. A physical device must be used.

The code you added in the previous step will show the push permission dialog upon app open. This can be customized using SDK methods to control when the dialog shows.

After accepting the dialog, log into the platform and navigate to Notifications > Create Notification and send your first notification, targeting the Native: iOS channel, to your device.

Next Steps

Once you have confirmed the SDK is working properly you may continue to add additional optional functionality like:

Last updated