iOS apps

Step-by-step instructions to migrate your iOS app to WonderPush

Already have a push provider? Migrating to WonderPush is easy, in most cases all you have to do is remove your existing provider, add WonderPush to your app and publish a new version to the AppStore.
When users install the new version, they will automatically be added to WonderPush.

📘

We've put together specific instructions for OneSignal users, Batch users and Accengage users.

This guide will help you remove your existing push provider from your app and add WonderPush. We will also explain how to import your existing users into WonderPush, although this is usually unnecessary as users installing the new version of your app will automatically be imported to WonderPush.

Shipping WonderPush in a new version of your app

Step 1. Removing your existing provider's Notification Extension

In your Xcode project General tab and identify the notification service extension entry. This entry will have an icon that looks like this: .

If you do not find this target, skip to the next step.

Select the NotificationServiceExtension target and click Edit / Delete.

1142

In the Xcode navigator (left hand-side panel), find the source files and the Info.plist file of the notification extension. They are usually named after the target you just deleted. Select the files or the enclosing folder and choose Edit / Delete. When asked if you want to remove the references or the files choose Move to trash.

544

Step 2. Removing your existing provider SDK

If you are using CocoaPods, open your Podfile and remove any line that mentions your existing push provider. For example:

pod 'OneSignal', '>= 2.6.2', '< 3.0'

If you are using Carthage, open your Cartfile and remove any line that mentions your existing push provider. For example:

github  "Accengage/accengage-ios-sdk-releases"
github  "Accengage/accengage-ios-extension-sdk-releases"

🚧

There might be more than one line to remove!

Step 3. Clean your AppDelegate and source files

Remove all the code that uses your existing provider's SDK. Your AppDelegate file is usually a good place to start, but you should go over your entire source code and ensure you remove all calls to your existing provider's SDK. Please note that most of the time you can replace such calls with their WonderPush equivalent. See our iOS SDK reference.

Step 4. Add WonderPush

Follow our iOS Quickstart guide to add WonderPush to your app, and publish a new version. Users that update their app will automatically appear in your WonderPush dashboard.

Importing your subscribers into WonderPush

Importing your existing subscribers into WonderPush will allow you to reach all of them via WonderPush right from the start.

Please note that you can usually skip this step and simply wait for your users to update their app.

Step 1. Export your subscribers from your existing provider

To import your existing subscribers, you must first export them from your existing provider. Whether your provider allows it is up to them. You will need at least each subscriber's push token. A push token is a hexadecimal string that allows us to reach a particular iOS device.

Step 2. Import your subscribers into WonderPush.

Take note of your Access Token which can be found on the API Credentials page.

For every push token, call the Create or update an installation method of our Management API by adapting the following snippet with:

  • an INSTALLATION_ID that must be an hexadecimal string (if you're unsure what to put here, you can use the push token itself),
  • YOUR_APPLICATION_ACCESS_TOKEN with the Access Token you've just taken note of,
  • PUSH_TOKEN with the push token.
curl -XPOST https://management-api.wonderpush.com/v1/installations/INSTALLATION_ID \
    -d accessToken=YOUR_APPLICATION_ACCESS_TOKEN \
    -d userId= \
    -d overwrite=false \
    -d body='{"pushToken":{"data":"PUSH_TOKEN"},"device":{"platform":"iOS"}}'

Please note that if you have lots of subscribers to import, you can use the /batch method of our API to create multiple installations in one call :

curl -XPOST https://management-api.wonderpush.com/v1/batch \
    -d accessToken=YOUR_APPLICATION_ACCESS_TOKEN \
    -d body='{"requests":[{"method":"POST","path":"/v1/installations/INSTALLATION_ID_1","args":{"userId":"","overwrite":true},"body":{"pushToken":{"data":"PUSH_TOKEN_1"},"device":{"platform":"iOS"}}},{"method":"POST","path":"/v1/installations/INSTALLATION_ID_2","args":{"userId":"","overwrite":true},"body":{"pushToken":{"data":"PUSH_TOKEN_2"},"device":{"platform":"iOS"}}}]}'

👍

That's it!

You can go to your dashboard segments page and see the newly created installations in the All users segment.