Push Notifications iOS Migration Guide

Create and Configure Beams instance

In order to complete this migration you will need a Pusher Beams Instance.

If you haven’t already, head on over to the New Dashboard and create a new Pusher Beams instance, noting down your Instance ID.

You’ll need to configure your iOS instance on the Pusher Beams dashboard, by going to the instance’s Settings tab. You can learn how to get the APNs key here.

Integrate Beams Swift SDK

Add SDK dependency which can be done by using CocoaPods or Carthage.
Ensure that Push Notifications capabilities are enabled.

Import the Beams SDK into your project:

import PushNotifications

Instead of creating an instance of Pusher:

pusher = Pusher(key: "YOUR_APP_KEY", options: options)

Use an instance of PushNotifications.shared:. In this case it’s pushNotifications.

self.pushNotifications.start(instanceId: "YOUR_INSTANCE_ID")

We’ve simplified the way how we register with APNs. Existing code:

let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in
    // Handle user allowing / declining notification permission. Example:
    if (granted) {
        DispatchQueue.main.async(execute: {
    } else {
        print("User declined notification permissions")

Can be replaced with:


Register with Pusher:

func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  pusher.nativePusher.register(deviceToken: deviceToken)

Can be replaced with:

func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

Subscribing to the interest changed from:

pusher.nativePusher.subscribe(interestName: "donuts")


try? self.pushNotifications.subscribe(interest: "hello")

Unsubscribe changed from:

pusher.nativePusher.unsubscribe(interestName: "donuts")


try? self.pushNotifications.unsubscribe(interest: "hello")

When the application receives a notification, there’s a new function to be called:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
  let remoteNotificationType = self.pushNotifications.handleNotification(userInfo: userInfo)
  if remoteNotificationType == .ShouldIgnore {

This function enables new features such as Insights.

Cleanup Old Dependencies

Remove the PusherSwift dependency from your Podfile or Cartfile and all associated methods and logic from your project.

Publish a Test Notification

The first step to test your migration is successful is to make sure the notifications are publishing from Pusher Beams to the migrated client device correctly.

  • Confirm successful migration by sending a test push notification.

The next step to verify that your migration is successful is to attempt to publish a notification to the same Interest using the beta push notification service. If the device has been migrated by installing the new client SDK, then you will no longer deliver a notification to it because the Interest subscription has been removed from the beta push notifications service.



Will the interests associated with specific device (device token) be copied over from the Push Notifications BETA product to Pusher Beams automatically?


Yes, all interests will be migrated from the old service to Pusher Beams. You can test this by sending a push notification to the specific device (device token) and interest.

Have you tried using the search to find what you’re after? If you still have a question then get in touch with us and let us help you out.