You'll need two things if you'd like to test the push notifications.
To complete the next step, you need to sign into your iOS developer account at Apple's iOS Dev Center. Choose Identifiers from the iOS Apps sections.
Click the plus button in the top right and enter an App ID Description. This helps you identify the App ID later.
You can leave the App ID Prefix as is, but the App ID Suffix needs to be set to Explicit App ID, instead of Wildcard App ID. If you want an application to receive remote notifications, then you need to use an Explicit App ID, such as com.tutsplus.push, instead of com.tutsplus.*.
In the section App Services, enable Push Notifications. Click Continue to submit the form and click Submit to create the App ID.
From the list of App IDs, select the one you just created and click the Edit button below it. Scroll down until you see the section that covers push notifications. You should see two buttons
The backend server communicates with Apple's servers to send remote notifications to your application. It sends remote notifications to your application via Apple's servers. For this reason, Apple needs to know that only your servers can connect to their servers. You don't want someone else to send remote notifications to your application.
1. Mac OS:- If you have a Mac or Macbook, then follow the steps to generate the certificate file.
Open Keychain Access on your development machine and select Certificate Assistant > Request a Certificate From a Certificate Authority... from the Keychain Access menu. Double-check that no key is selected in Keychain Access when you select this option.
Enter an email address and a Common Name to identify the certificate later. Leave the CA Email field empty and select Saved to disk. Click Continue and save the certificate signing request to your hard drive.
You have created a few things by completing this step. You've created a certificate signing request as well as a public and private key. The keys should be visible in Keychain Access as shown below.
2. Other Os - If you don't have a Mac or Macbook, then follow the steps on Windows or any Linux Environment for generating the Certificate file
Head back to the iOS Dev Center and click the Create Certificate... button that we saw earlier. Apple tells you which steps you need to take to create the certificate signing request, but we've already completed those. Click Continue, upload the certificate signing request by clicking the Choose File... button, and hit Generate to generate the SSL certificate.
As Apple instructs, download the certificate and double-click it to install it in Keychain Access. Double-check that the certificate is added to Keychain Access and linked to the correct private key.
Before we can test our push notifications setup, we need to create a provisioning profile for our application. In the iOS Dev Center, select Development in the Provisioning Profiles section. Click the plus button in the top right and select iOS App Development under the Development section.
Click Continue and select your App ID from the list. Select the certificates you want to include in the provisioning profile and click Continue. Because we're creating a provisioning profile for development, we also need to specify which devices need to be included in the provisioning profile. Make sure your test device is included. Give the provisioning profile a sensible name and click Generate.
Go to the StoreHippo Control Panel and click on the Mobile Apps section.
In the Mobile Apps section click on Mobile Signing Keys section to add the signing keys
Save the record after filling the form.
After the record has been saved, the key has to be processed so that it could be used with the mobile app. For that click on Actions and select Process Key.
After it has been processed then build the app with the required key in the mobile app section. (Build for iOS).
If you run into issues, then double-check that the bundle identifier of your application matches that of the App ID. Note that a bundle identifier is case sensitive.
If you've followed the steps outlined in this tutorial, your application should prompt you with the following message.
If you tap OK, your application will ask the operating system for a device token. If this is successful, then you would get an entry in the entity Mobile Users with the GCM ID filled with the value that the device provides.
There are currently two options for sending Push Notifications to the users.
Use a universal client SSL certificate (A client SSL certificate is a certificate that allows a developer’s server to connect to an Apple service. For example, developers use a client SSL certificate to communicate with the Apple Push Notification service.) to establish a connection between your notification server (in both the development and production environments) and the APNs. Create a separate client SSL certificate for each app you distribute that uses push notifications.
Launch Keychain Access located
Choose Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.
In the Certificate Assistant
In the Common Name field, enter a name for your private key (for example, Gita Kumar Dev Key).
Leave the CA Email Address field empty.
Choose “Saved to disk”, and click Continue.
Export the identity from the keychain on the Mac where you created it, and copy it to the appropriate place on the server that runs the provider code and connects with the development or production version of APNs.
Files in the Personal Information Exchange format have a .p12 file extension, and files in the Privacy Enhanced Mail format have a .pem file extension.
You can also use token-based authentication to communicate with the APNs. Get one authentication key to sign tokens for multiple apps. The authentication key doesn’t expire but can be revoked.
Important: Save a back up of your key in a secure place. It will not be presented again and cannot be retrieved later.