My iOS APNS certificate expired and we (our iOS developer and I) ended up revoking the old certificate through iTunes Connect and completely starting over after having some issues. Everything is working now and I was able to send test notifications to our devices.
However, we had to regenerate the device token before any notifications came through. I believe this issue was because our devices were previously on a development version of the application (different tokens), and we were attempting to use the production token.
Does anyone know (and can back up with documentation) if device tokens will persist through the revoking/recreation of our APNS certificates? If not, I will have to delete all of the existing tokens and wait for users to re-open the app.
As you said, you had to regenerate the device tokens only because the same device gets a different device token for the sandbox env and the production env.
Creating a new certificate doesn't change the device tokens (and pre-iOS7, all the apps on the same device had the same device token, so changing the certificate of one app couldn't affect the device token). I've never seen this documented, but this is the behavior I experienced, and it makes sense, since the push certificate is not part of the deployment of the app (it's only used in the server side), and therefore changing it can have no effect on the device token (which is received by the app).
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.
I am trying to testflight my app, but when I use notifications I get an error because I have a development APN instead of a production APN. My problem is uploading it to parse. First I created a development SSL Certificate, then I went back and did a Production SSL Certificate, but I am having trouble uploading the Production Certificate because It's not an APN, rather a Apple Push Services. I also created a Distribution Provisioning (ad hoc).
Apples Push Notification service is a bit strange:
On the client side:
If you build your client with Xcode you usually build a "Debug" version of your app. In that case the registerForRemoteNotification method will create a sandbox device token for you.
If you build a "Release" version of your app the same method create a production device token for you.
On the server side:
If you have a sandbox device token you can only send a push notification to that device if you use Apples sandbox Push Notification service with your sandbox SSL certificate.
If you have a production device token then you have to use Apples production push notification service with your production SSL certificate to send a push notification to that device.
The tricky part is:
if you only have a device token you will not know if it is a production device token or a sandbox device token.
if you want to use release and debug clients against the same server, that server has to use the sandbox and the production service at the same time. And you need a mechanism to decide when to use which service.
BTW: there is a nice tutorial by Ray Wenderlich which also contains a useful PHP script for easy testing.
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
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.
I am testing push notifications with production.pem with ADHoc provisioning certificates. From server side sending successfully but device is not getting notifications. Please help me
Thank you
The Server will show success means the problem is at your side, Check the below three scenarios for this
1.) The gateway should be gateway.push.apple.com:2195
2.) You have refreshed your provisioning profile after creating APNS certificate
3.)Your Device Token is correct corresponding to the Distribution Provisioning profile
N.B If all the above things are correct,then make sure your app is in background, If your App is in foreground, then you will receive push notification, but wont be able to see it
Keep in mind that the Ad hoc testing of push notifications only works if the app was installed on a device without using xcode+usb cable to install the app on the device. The app has to be delivered to the phone with either TestFlight (or similar) or something else like diawi.com
You can check in server side.
List<PushedNotification> notifications = Push.alert("TEST TEST",keystorePath,"test", ***true***, devices); => For Distribution
For development => List<PushedNotification> notifications = Push.alert("TEST TEST",keystorePath,"test", ***False***, devices)
Check your device token. There are two device tokens. First one is when you run app with development other one is run app with production. These are difference. Use Ad-hoc device token.
When in development, it works well, I can push notification to device.
but when distribution I can't get notification.
After debug I found the reason is that my server didn't receive device token from app.
I'm sure I used the correct provisioning and enabled the apps for both development and production.
anybody knows what's the reason that app can't get device token?