Swift
Last updated
Last updated
Go to your Push.Express account
Open existing App settings or create a new App
Switch type application iOS
Enter the Bundle Identifier of your application in the Bundle ID field
You can view the Bundle Identifier of your application in the XCode TARGETS of your application > General tab in the Identity section, you will see the Bundle Identifier field.
Enter your Team ID in the Team ID field.
You can view your Team ID in the XCode TARGETS of your application > Signing & Capabilities tab in the Signing section, you will see the Team field.
Enter your ID APNs Authentication Key in the Key ID field.
7. Enter your Private key APNs Authentication Key from the file .p8 in the Private key field.
You can created Private key APNs Authentication Key in your Apple Developer Account > Certificates, Identifiers & Profiles > Keys section
Add the SDK to Xcode using Swift PackageManager. To do this, go to File > Add Packages... > Enter the repository URL SDK (GitHub) https://github.com/pushexpress/pushexpress-swift-sdk.git > Click the button Add Package
Add Remote Notifications in Background Modes. To do this, go to the XCode TARGETS of your application > Signing & Capabilities > press the button + Capability > select Background Mode from the list > check the box Remote Notifications.
Enable Push Notifications in Xcode. Go to the XCode TARGETS of your application > Signing & Capabilities > press the button + Capability > in the list, find and select Push Notifications.
Create an application (App ID). Go to Apple Developer - Certificates, Identifiers & Profiles > go to the Identifiers section > create a new ID for your app (App ID) > enable the option Push Notifications.
Add sdk initialization to AppDelegate.swift
To configure the sdk, use the following parameters: PUSHEXPRESS_APP_ID - The application ID in the Push service.Express, displayed in the section Applications. myOwnDatabaseExternalId - You can use this parameter to set your own device ID. PushExpressManager.shared.tags - Use tags to set additional attribution. Use the PushExpressManager.shared.tags["audiences"] tag to transfer the segment code, and Push Express Manager.shared.tags["webmaster"] to transfer the webmaster code. PushExpressManager.shared.activate и PushExpressManager.shared.deactivate - Activate and deactivate the sdk at the right moment.
Add the Notification Service Extension to the Xcode project, which will allow you to modify push notifications before displaying them. To do this, File > New > Target > In the window that opens, select Notification Service Extension (under iOS → App Extensions) > Click Next > Specify the extension name (for example, NotificationService) > Click Finish > activate Notification Service Extension
Add sdk in TARGETS of your Notification Service Extension > Build Phases > Link Binary With Libraries section. Press " + " and enter the link to the push express sdk in the search box > select SdkPushExpress > click Add
Add the sdk code to Notification Service Extension.
It is worth considering in which environment your application was launched. Sandbox or Production APNs tokens are not interchangeable. APNs tokens are not generated on Xcode simulators. This is an Apple limitation because simulators do not support registration for remote notifications. Only real devices can request and receive APNs tokens. Make sure that the devices have appeared in the Push Express service in the devices and each device has a Token field filled in.
Sandbox (Debug): Used when developing and testing an application via Xcode. The application runs on a device connected to Xcode. If you are using this mode of operation of the application, then set the Sandbox switch in the application settings of your personal account Push Express.
Production (Release): Used when the app is published in the App Store or TestFlight.If you are using this mode of operation of the application, then set the Production switch in the application settings of your personal account Push Express.