richsage / RMSPushNotificationsBundle

NOT MAINTAINED! ⛔️ Push notifications/messages for mobile devices. Supports iOS, Android (C2DM, GCM), Blackberry and Windows Mobile (toast only). A Symfony2 bundle.
MIT License
321 stars 152 forks source link

Can't manage to get IOS push notification working #60

Open Maxwell2022 opened 10 years ago

Maxwell2022 commented 10 years ago

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

ZhukV commented 10 years ago

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

Maxwell2022 commented 10 years ago

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

ZhukV commented 10 years ago

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

Maxwell2022 commented 10 years ago

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 commented 10 years ago

I'll submit a PR with documentation improvement ;)

jnanendraveer commented 5 years ago

Guys- This still pending?