How to generate .PEM file for iOS
In order to send push notifications to iOS devices, you must generate a .pem file for your app and upload it to your Push IO account. It is assumed in these instructions that you have already set up a Push IO account.
This stage will involve 3 applications on your computer:
1) The iPhone Developer Provisioning Portal
2) Keychain and
Step 1: Open your web browser and log in to the iPhone Developer Provisioning Portal. On the left menu bar, select the App IDs option. To enable push notifications, you must ensure your App Bundle ID is push compatible. It cannot contain wild-card characters like asterisks (*). Instead, specify an App ID which includes your app name.
Bad ID Ex: com.yourcompany.* Good ID Ex: com.yourcompany.YourApp
From the App ID Details screen, click the checkbox to “Enable for Apple Push Notification service.” Then, click the Configure button on the “Production Push SSL Certificate” line. Clicking this button will launch the Apple Push Notification service SSL Certificate Assistant.
IMPORTANT NOTE: You must re-generate your Ad-Hoc (and App Store) provisioning profiles AFTER enabling Apple Push Notifications for your app.
Step 2: Using the instructions provided in the first screen, launch the Keychain app in Mac OS X and “Request a Certificate.” Ensure the “Saved to disk” on the “Request is:” option, and click the checkbox next to “Let me specifiy key pair information.”
Click the Continue button. Use the dropdowns on the ensuing screen to specify “Key Size” at 2048 bits and “Algorithm” as RSA. Click the Continue button once more and save the Push Certificate Request to your hard drive in the default location.
Step 3: Upload your Push Certificate Request back in your Apple Push Notification service SSL Certificate Assistant web browser window using the instructions provided. You may have to click the “Continue” button if it is still on the “Generate Certificate Signing Request” screen. Click the Generate button. Once your SSL Certificate has been generated, click the Continue button and download your .cer Certificate file.
Step 4: In Keychain, select “My Certificates” from the lower left menu bar, and import the .cer Certificate file you just downloaded. Export the file from Keychain as a .p12 to your desktop. Make sure it is the correct Distribution certificate (not Developer). Rename it after your application if you wish (ex. MyPushApp.p12). DO NOT PASSWORD PROTECT YOUR .p12 FILE. LEAVE THE PASSWORD FIELD BLANK AND PRESS ENTER.
Step 5: Ensuring the .p12 file you exported from Keychain is on your Desktop, open Terminal and run the following commands, changing MyPushApp to the name of the .p12 file you created previously:
openssl pkcs12 -in MyPushApp.p12 -out MyPushApp.pem -nodes -clcerts
Step 6: Upload the .pem file to your manage.push.io under YourTestApp in the Platform section.
You are NOT able to test push notifications in the simulator. You must get your app onto a device in order to test.
May 21, 2013 / roymj88 / 1
- Google API
- Google Maps
- Hybrid Apps
- Mobile Application Development
- mod rewrite
- Push Notification
- Random Quotes
- Source Code
- Web Development