RMSPushNotificationsBundle icon indicating copy to clipboard operation
RMSPushNotificationsBundle copied to clipboard

Can't manage to get IOS push notification working

Open Maxwell2022 opened this issue 11 years ago • 6 comments

I think it's missing some documentation about iOS and how to generate the certificate and passphrase. I've followed a neat video that it's explaining how to do ti (for another service, but still the same process): https://www.youtube.com/watch?v=12yjIm0Z8Cw

  1. Generated CSR from keychain
  2. upload the CSR to apple developer and download the generated certificate
  3. Add this certificate to the keychain
  4. Export the certificate (as p.12 format) setting a passphrase
  5. Copy the exported certificate to the app folder (app/certificates for me)

Here is my configuration:

rms_push_notifications:
    android:
        gcm:
            api_key: xxxxxxx
            use_multi_curl: true # default is true
    ios:
        sandbox: true
        pem: "certificates/xxxx-apns-dev-cert.p12" # can be absolute or relative path (from app directory)
        passphrase: "xxxxx"

Now I have a p12 certification and the passphrase I've created. If I try to send a push notification I get the following error:

PHP Warning: stream_socket_client(): Unable to set local cert chain file `/var/www/xxxx/app/certificates/xxxxx-apns-dev-cert.p12'; Check that your cafile/capath settings include details of your certificate and its issuer in /var/www/xxxx/vendor/richsage/rms-push-notifications-bundle/RMS/PushNotificationsBundle/Service/OS/AppleNotification.php on line 196

Maxwell2022 avatar Apr 11 '14 06:04 Maxwell2022

Your must generate a *.pem file and set to configuration.

ZhukV avatar Apr 11 '14 06:04 ZhukV

Ok, looking at the configuration I think the bundle is waiting for a .pem certificate

To generate one from the .p12 I had, I did the following: openssl pkcs12 -in zumny-apns-dev-cert.p12 -out zumny-apns-dev-cert.pem -nodes -clcerts

And update my config file to point to the .pem file:

rms_push_notifications:
    android:
        gcm:
            api_key: xxxxxxx
            use_multi_curl: true # default is true
    ios:
        sandbox: true
        pem: "certificates/xxxx-apns-dev-cert.pem" # can be absolute or relative path (from app directory)
        passphrase: "xxxxx"

And it's now working. I think more documentation about this would be a great plus for the bundle ;)

Thanks everyone

Maxwell2022 avatar Apr 11 '14 06:04 Maxwell2022

http://stackoverflow.com/questions/21250510/generate-pem-file-used-to-setup-apple-push-notification

ZhukV avatar Apr 11 '14 06:04 ZhukV

yes, but having the doc at the same place than the bundle or at least linking the doc in the bundle would have saved me a lot of time ;)

Maxwell2022 avatar Apr 11 '14 06:04 Maxwell2022

I'll submit a PR with documentation improvement ;)

Maxwell2022 avatar Apr 11 '14 07:04 Maxwell2022

Guys- This still pending?

jnanendraveer avatar Mar 17 '19 06:03 jnanendraveer