
This tutorial helps run you through the steps necessary to successfully install Easy APNS.
First step is to request a certificate from a certificate authority. Open up Keychain from Applications > Utilities.

Then enter your email and a common name for the certificate. Your name is fine. Select “Saved to disk’.
This will generate a file called “CertificateSigningRequest.certSigningRequest”. You now need to upload this in your Apple Developer account.
- Go to iOS Provisioning Portal
- App IDs
- Click ‘Configure’ beside your app.
- Click ‘Enable for Apple Push Notification service’.
- Click ‘Configure’ button next to Development.
- Click ‘Continue’
- Upload the ”CertificateSigningRequest.certSigningRequest” file.
This will generate a aps_developer_identity.cer certificate. Double click on it to load it into your Keychain.
- Repeat for Production.
You will now need to regenerate a development Provisioning Profile for your app because the current one you won’t be aware that of the push notification capabilities.
Go to Provisioning in the sidebar and click ‘Edit’, then ‘Modify’ next to your app. You need to change something for it to regenerate a new provisioning profile (I read this somewhere). I just deselected one of my development devices. Then click Submit.
Refresh the page and your Provisioning Profile should be ready for download.
Now go into Organizer in Xcode and delete the oldProvisioning Profile. Drag your new profile into Xcode to install it.
You will now need to change the coding signing entries in Build Settings to reflect your new Provisioning Profile. Make sure you change the code signing settings under “Targets” as well as Project. This gave me grief until I did this as my app kept being built with the old Provisioning Profile.
You will need to Delegate code to your app, which comes included in Easy APNS. Instructions here. This file will need amending, it needs to include the URL where you have installed Easy APNS on your server.
NSString *host = @”www.yourside.com/apns”;
Also make sure you type the correct protocol. I’m using HTTPS so I have this… change it to HTTP if you don’t have an SSL certificate for your website.
NSURL *url = [[NSURL alloc] initWithScheme:@”https” host:host path:urlString];
Before you build your app, you will need to upload the Easy APNS files to your website and create the database. Make note of the database name, user and password as you will need to edit the ‘apns.php’ file to include them.
Follow this video to help you FTP and amend the PHP files and I’ll take you through generating the PEM files.
Make sure your ‘apns.php’ file has these values:
/** * Absolute path to your Production Certificate * * @var string * @access private */ private $certificate = 'apns-cert.pem';/** * Absolute path to your Development Certificate * * @var string * @access private */ private $sandboxCertificate = 'apns-dev-cert.pem';
Easy APNS requires two PEM files:
- apns-dev-cert.pem
- apns-cert.pem
To create these files you must first export a .p12 version of your Push Notification certificate from Keychain Access. To do this open up Keychain Access, select ‘Certificates’ from the ‘Category’ menu in the left hand sidebar.
Right click on your Development certificate (you will need to repeat for the Production certificate) and click ‘Export’. In the ‘Save As’ box type ‘apns-dev-cert’. Make sure you have .p12 selected as the file format and click ‘Save’.
Click on the arrow to open up branch and reveal your “Dev Key”. Right click Export. Save as “key.p12″.
For ease save them to two separate directories, e.g. /Dev and /Prod
Now open up Terminal and navigate to the directory you saved your .p12 files to and type.
cd /your-directory/Dev
openssl pkcs12 -clcerts -nokeys -out cert.pem -in aps-dev-cert.p12
Enter Import Password: [leave blank and press Enter]
MAC verified OK
openssl pkcs12 -nocerts -out key.pem -in key.p12
Enter Import Password: [leave blank and press Enter]
MAC verified OK
Enter PEM pass phrase: [enter any pass phrase, min 4 characters]
Verifying – Enter PEM pass phrase: [repeat the above pass phrase]
openssl rsa -in key.pem -out key.unencrypted.pem
Enter pass phrase for key.pem: [enter the above pass phrase]
writing RSA key
cat cert.pem key.unencrypted.pem > apns-dev-cert.pem
cd ..
cd Prod
[now repeat for the Production certificate but change apns-dev-cert.pem to apns-cert.pem ]
Now upload apns-dev-cert.pem and apns-cert.pem to your server, in the same directory as apns.php. CHMOD them 644.
You can now build your app for Development purposes, which will install the new provisioning profile on your device. When your app runs you will be presented with a Push Notification prompt, confirm to accept Push Notifications for this app. This will ping your server where Easy APNS is running to register your device in the database.
Open up phpMyAdmin and go to the Devices table. Your device should now be there, click Browse, then Edit. Change the Development type from production to ‘sandbox’. Since your app was built using a Development provisioning profile you can only receive notifications from Apple’s sandbox server.
You should now be able to run one of the samples in ‘samples.php’ and your device should receive a Push Notification.
I hope that helps! I decided to write this blog immediately after successfully installing Easy APNS and receiving my first Push Notification. I found a lot of the tutorials online spoke about generating a ‘ck.pem’ file, but not once did they mention, this is the file that needs to be uploaded. So in my tutorial I’ve explicitly made it generate the correct filenames.







This is a great idea.I just found out about Prowl (Growl on iphone) via push noitficaitons on the iphone and was wondering if someone was working with integrating push noitficaitons using Nagios.It’d be great if you can include me on the beta program, I’d be happy to help in any way I can. This would be a great app for any server admin.Good luck!
First of all thanks for writing your tutorial. I’m at the same step now, and searching for a step by step to get my certificate working.
You wrote that to generate apns-dev-cert.pem and apns-cert.pem, we should export our certificates from Keyfinder in .p12.
Next step is to generate cert.pem from cert.p12?
And then generate key.pem from key.p12?
Please explain where they come from.
Cheers
thanks for tutorial. found it here:
http://www.verious.com/board/Giancarlo-Leonio/preparing-an-application-to-use-push-notification-ios/