Cannot send push notifications using Javapns/Javaapns SSL handshake failure

前端 未结 2 913
北恋
北恋 2020-12-01 02:30

I have an issue with push notifications. I have a p.12 certificate that was created by a team member and I have the device token for the device to be pushed to. I am using t

2条回答
  •  庸人自扰
    2020-12-01 02:53

    I am a new iOS developer and I had the same issue before.

    I finally found that the problem was due to the p12 certificate. We should not use the private key p12 file, instead we should generate a p12 from your private key and the cert download from Apple.

    Please execute the following OpenSSL command to get the correct p12 file:

    developer_identity.cer <= download from Apple
    mykey.p12 <= Your private key
    
    openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM
    openssl pkcs12 -nocerts -in mykey.p12 -out mykey.pem
    openssl pkcs12 -export -inkey mykey.pem -in developer_identity.pem -out iphone_dev.p12
    

    After that, you should use iphone_dev.p12 to communicate with apple server.

提交回复
热议问题