2. Push Notifications With Dashboard and Swift
• In this guide, we will show how properly set your app to work with Parse
Push notifications and how send a notification from Parse Dashboard.
• You can read the original publication on:
• http://docs.back4app.com/docs/ios/push-notifications-with-dashboard-and-
swift/
3. Step 1: Register your app to receive notification
1. To make you app support Push Notifications, your app must use an Explicit
App ID.
• Navigate to the Apple Developer
Member Center website,
and click on Certificates,
Identifiers & Profiles.
4. Step 1: Register your app to receive notification
2. Select Identifiers on the iOS Apps section.
3. You will see a list of your App IDs. Click on the + button.
4. Enter a name for your new App ID under App ID Description, choose an App
Id Prefix, and under App ID Suffix, select Explicit App ID, enter your iOS app’s
Bundle ID, it should match the Bundle Identifier in your Xcode project
configuration and in the Info.plist file.
5. Step 1: Register your app to receive notification
5. Enable Push Notifications under App Services. Enable other services that
your app will need.
6. Click on “Continue”, confirm that all values were entered correctly. Click on
“Submit”.
6. Step 1: Register your app to receive notification
• Now that you’ve created the App ID, you need to configure the App ID for
Push Notifications.
1. Select your new App ID
and click on “Edit”.
7. Step 1: Register your app to receive notification
2. Scroll down to the Push Notifications section.
• Click on “Create Certificate”
under “Development SSL
Certificate”.
8. Step 1: Register your app to receive notification
3. Follow the instructions in the next screen to create a Certificate Signing
Request (CSR) using the Keychain Access utility on your Mac.
• This is needed to authenticate the creation of the SSL certificate.
4. Upload the CSR to Apple’s servers, then click on “Generate”.
9. Step 1: Register your app to receive notification
5. Add the certificate to your login keychain.
10. Step 1: Register your app to receive notification
6. Open the Keychain Access utility, and locate the certificate under “My
Certificates”.
It should be called “Apple Development Push Services:”.
Right-click on it, select “Export”, and save it as a .p12 file.
11. Step 1: Register your app to receive notification
Do not enter an export password when prompted!
12. Step 1: Register your app to receive notification
• You will need to repeat the process to make the Production SSL Certificate.
• Now we need to configure the Xcode project.
13. Step 1: Register your app to receive notification
1. Go to your project’s Capabilities page, then turn On Push Notifications. If
there are any issues that require your attention, Xcode will let you know.
14. Step 1: Register your app to receive notification
2. Go to the General page.
• Modify the Bundle Identifier to match your App ID’s Bundle Identifier.
15. Step 2: Register your app to receive notification
in the back4app Dashboard
1. Go to your app back4app Dashboard
2. Click on “iOS Push Notification Settings”
16. Step 2: Register your app to receive notification
in the back4app Dashboard
3. Click on “Choose File”, select your .p12 certificate, then click on “Send”
17. Step 3: Implement Push Notifications Functions
1. Go to AppDelegate.swift file.
• In the application: didFinishLaunchWithOptions method, insert the
following code after the Parse initialization:
• This code are notifications types and settings for the app
18. Step 3: Implement Push Notifications Functions
2. Next we have to register the application, to make it capable of receive and
send notifications. Just add this code bellow the code you just have write:
19. Step 3: Implement Push Notifications Functions
3. Next we have to subscribe the app in a channel for enable the background’s
notifications.
• Insert this code in the AppDelegate.swift file:
• Now the app can receive background notifications.
20. Step 3: Implement Push Notifications Functions
4. It’s also possible to send notifications to just a group of people.
• For this, we have to register the app for the group’s channel.
• When you send a notification to a channel, all the app’s installations that
have the channel in the channels field will receive the notification.
21. Step 3: Implement Push Notifications Functions
• To register a installation in a channel, we use the following code:
• Now the device will receive all the notifications directed to be back4app
channel.
22. Step 3: Implement Push Notifications Functions
• 5. If now we dont want anymore to the device receive notifications in
back4app channel, we just need to unregister the installation in the back4app
channel:
23. Step 3: Implement Push Notifications Functions
• We can check whats channels the installation is registered using the channels
field of the PFInstallation object:
24. Step 4: Sending notification from Dashboard
1. Go to your app’s Parse Dashboard, and click on Push.
2. Now chose the audience of the notification. You can send notifications to
everyone and for a specific platform.
3. Write the notification text, then click on Send Push to send your
notification.