I have push notifications working perfectly for my app using the development aps-environment. However they do not work for the production environment. As far as I an aware, all my certificates and private keys are correct.
I am trying to test the production aps-environment on an ad-hoc distribution provisioning profile, not my App Store profile.
I'm wondering us it even possible to test production push notifications with an ad-hoc profile?
Is there anything else I should be checking for?
I just had the exact same issue. Drove me crazy for a day. Did you change the APNS server URL in your PHP script to 'ssl://gateway.push.apple.com:2195' ? This is different from the what is used during development.
Also make sure you have all the production certs in place, etc...
Yes, it is possible to use production push notifications with an Ad-Hoc profile; Ad-Hoc is considered to be production just like the App Store profile. Make sure you are:
actually building your app with the production profile (not development),
using the production push cert on your server (not development), and
hitting the production apple push gateway server (not the sandbox).
Apple keeps the development environment completely separate from the production, so if those three things do not line up, it will not work. You cannot mix and match them.
If you are sure your certificates et al are correct, also check that you're trying to send to your payload to the Production push token of your device. Each device has two distinct push tokens - one for development and one for production. You cannot send a push notification to a development push token via a production certificate.
Related
I have a Development APNs iOS Certificate for my new app, and from my server I am successfully sending push notifications and receiving them on own iPhone, using the device token. I have a partner in this app development, and I create an .ipa file of the app and give it to him for testing. This is called ad-hoc development. It has worked for us thus far.
From my server it looks like I am successfully sending out the push notification to his device as well as mine, using HIS device token of course (but using the same Dev APNs Cert), but he never receives the notifications. I still continue to receive my notifications. I also have registered his device in my dev center. He does not have a developer account.
So after reading up a little I am thinking that maybe with this APNs Dev certificate it is impossible to send notifications to third party devices, like my partner's device in this case. I was thinking perhaps I need to create a DISTRIBUTION certificate. Is this true? Or should the notifications work for many devices just using the APNs Dev certificate?
Thanks
Pushes go out over two environments - development and production and they are not interchangeable - i.e. if you send out a push to the Apple development server intended for a release build app it won't work and vice versa.
Apps installed and run via Xcode are debug builds and you need to send the push via the dev server, an app built for distribution is a prod build and thus the pushes need to go to the prod server.
As you are probably aware the url for the two servers is different.
Needless to say the server needs to be signed with both the prod and dev push certificates for the server to be able to send pushes on both environment.
BTW the two environments do not behave the same in terms of delivery speed etc. But this is only really noticeable for silent pushes, where bizarrely the dev environment is better than the prod one.
This is maybe a strange question but it is really confusing me. Why do we have to create a development and a production SSL certificate for push notifications in iOS? What is the difference between the development and the production certificates?
I am developing an iOS app with Push notifications (handled by a self-hosted Parse Server) and when I switch my environment from development to production (with a production certificate), I don't receive the push notifications anymore on my devices. Will it work once I upload this app to the app store (then, it will be in production)? Or can I "test" my production environment to be sure the notifications will work in my app once published on the app store?
Apple uses different servers for sending push notifications to development versions and app store versions of the app. The development version is called Sandbox. The iOS maintains persistent connection to the its push servers depending on whether its development version or production version. Based on which certificate your app is signed (Dev or App Store/Ad Hoc) it will create a persistent connection to the respective push server. Since the two servers are different they will need different SSL certificates to establish a secure connection to the server.
For more info refer:
https://developer.apple.com/library/ios/technotes/tn2265/_index.html
If you are testing a push notifications in your app that time you easily check through debugging mode for this purpose you need Development SSL certificate. If you uploaded the app into App Store that time you need to add Production SSL certificate (for live app push notifications purpose you want to add production SSl).
My push notifications are working fine with the sandbox model. I just verified that the production ssl certificate is working both with direct SSL-connection and with AWS SNS. However, my device is still producing the same push token as it produced for the sandbox, and this token is not working for production-level push notifications (rejected as invalid token by Apple server). Is it supposed to work? How can I make sure push notifications are working/will work for users who download the app from the app store?
Create a provisioning profile for "Ad Hoc" distribution, using your production certificate. Sign your app with that and install. Make sure your SSL connection to APNS knows which certificate to use, depending on whether client is production or dev.
My app is not released yet, so you couldn't find it in the App Store. But it is being used by a group of private beta users (through the iOS TestFlight service). And it is hitting my production server, which is the reason for the question.
In the situation described above, what .p12 do I use? the Dev certificate or the Distribution certificate? I am asking because I am not clear on whom the distinction is for. As far as my server is concerned I don't care which one is used. I just need to send push notifications, and as long as the users get them, I am happy. And since I am using my production server, I figure I should use the production/distribution certificate. But I have a suspicion that my server -- dev or production -- has nothing to do with it. And which certificate I use may entirely have to do with the App Store. So will someone please clarify for me? Thanks.
From http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Development If your app is running in Debug mode and is signed with the Development provisioning profile (Code Signing Identity is “iPhone Developer”), then your server must be using the Development certificate.
Production Apps that are distributed as Ad Hoc or on the App Store (when Code Signing Identify is “iPhone Distribution”) must talk to a server that uses the Production certificate. If there is a mismatch between these, push notifications cannot be delivered to your app.
I'm wondering what kind of Remote notification (APN) certificate do I need to use with Ad-hoc, development or production?
I was expecting I would need to use the production one, but surprisingly it worked with development.
Now, the issue with this, is how I'm going to make sure if I correctly generated the production APN certificate, if there is no way to test except when the app go live.
From Apple's documentation
"apps distributed via ad-hoc use the apple production push gateway (gateway.push.apple.com),
not the apple dev push gateway"
For adhoc builds use SSL certificate for production and not for development.