How to Test Push Notification in your iOS device using Pushever

Firstly, you will need to generate a Certificate Signing Request (CSR) via Keychain Access app on your Mac machine.

Then, go to your app’s identifier > Tick “Push Notifications” > Press “Configure”

Select “Create Certificate” under Development / Production SSL Certificate

Lastly, upload the Certificate Signing Request (CSR) file that you created earlier and press “continue” to create and download the certificate to your machine.

Then, double click your certificate to open it in Keychain Access. Go to My Certificates > Expand and select both certificate and private key. After that, right-click and select Export 2 items.

Finally, save the file in Personal Information Exchange (p12) format.

Convert the .p12 certificate to a .pem by running this command in your terminal.

openssl pkcs12 -nodes -clcerts -in <Your_Certificate_Name>.p12 -out <Your_Certificate_Name>.pem

Then, download Pushever App Free Trial Version from https://pushever.app/ and open it. Then, drag and drop your pem file into the pem column in the app and key in your app’s bundle id and your device’s device token.

You can get the device token of your app in your device and convert it to a hex string and copy-paste it to the Pushever app

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let apnsTokenHexString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
    ...
}

Finally, select the environment of your certificate: production or development, finally press the Send Push button!

Push Notification in the app

Command Line

You can also send the push notification to Apple APNS via command. Here is a simple curl script to do that:

curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle>" \
-H "apns-priority: 10" \
--http2 \
--cert <Your_Certificate_Name>.pem \
https://api.sandbox.push.apple.com/3/device/<token>

You can change the API endpoint based on its environment:

You can read more about it in Apple documentation.

Leave a Comment

Your email address will not be published. Required fields are marked *