Skip to content

Push Notifications

1) Enable push capabilities

Inside Xcode, navigate to the “Capabilities” tab of your app. You will need to enable “Push Notifications”.


2) Generating a Certificate Request

2.1) Launch the “Keychain Access” app on your Mac.

2.2) Select “Keychain Access> Certificate Assistant> Request a Certificate From a Certificate Authority”.


2.3) Enter your e-mail, select “Save to disk” and press “Continue”. You should get a .certSigningRequest file.


3) Get the Certificate

3.1 Open, select your app and press “Edit”.


3.2 Scroll down the page and enable Push Notifications. Press “Create Certificate” (Usually you would want to create a production certificate).


3.3 You should find yourself in the “Add iOS Certificate” wizard. Press “Continue”.


3.4 Press “Choose File” and upload the .certSigningRequest file you generated previously (chapter 2.3)


3.5 Your certificate is ready. Press “Download” to get the .cer file.


4) Upload a .p12 Key to NearIT

4.1 Click on the .cer certificate you generated previously (chapter 3.5). It will open the “Keychain Access” app on your mac.

4.2 Find your certificate, click on it and select “Export”. Enter a password, you will get a .p12 file.


4.3 Open NearIT web interface, select your app and navigate to “Settings> Push Settings”. Upload your .p12 under the “Setup iOS push notifications” block. You will be prompted to enter the password you have chosen previously (chapter 4.2)


5) Get the device token

In your app code, ask for the token:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
    // ...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [application registerForRemoteNotifications];
    // ...

When you get the token, just give it to the SDK:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [manager setDeviceTokenWithData:token];

To test that everything went ok, you should enroll your device as a Test Device and send it a test push from the “Settings> Push Settings” section.

The app is now able to receive push notifications from NearIT.