Generally in iOS apps server side is coded in PHP and to integrate APNS we can create .pem file by following this RayWenderlich tutorial.
But we might face difficulty in receiving remote notification on device when server side coding is done in Java. This is because the private key p12 file doesn't work with Java. We should use following OpenSSL commands to generate another p12 file from the private key and the .cer download from Apple. This new file is actually the correct one to be used with Java.
aps_dev.cer -> downloaded from Apple developer
private_key.p12 -> private key
- openssl x509 -in aps_dev.cer -inform DER -out aps_dev.pem -outform PEM
- openssl pkcs12 -nocerts -in private_key.p12 -out private_key.pem
- openssl pkcs12 -export -inkey private_key.pem -in aps_dev.pem -out aps_dev_java.p12
Finally we should use aps_dev_java.p12 at server end for sending notifications.
2 Comment(s)