iOS Push notifications for Production - ios

I am an Objective-C developer, and I created an app for iOS with push notifications. The only doubt
I have to clear is that with my iPad, I am testing the push notifications with development certificates. Push notifications are working fine with developer certificates and don't work for production.
For extending it to production, will replacing the Development certificates with Production certificates be enough, or are there any other changes required?

In addition to replacing the push certificate used by the server, you have to build the app with production or AdHoc provisioning profile, and your server should send notifications to the APNS production server.

You also need to change the gateway to gateway.push.apple.com from sandbox in your backend code for sending notification. Also make sure that you have right certificates as suggested by others.

You have to get it right
Developer Cert / provision + .p12 exported for developer certificate + sandbox.push.apple.com -> success
Prod Cert / provision + .p12 exported for prod cert + push.apple.com -> success
If you change the combination it will not work. Also check if Push Token (Postal) is generated by application signed with right certificate.

Related

Which CertificateSigningRequest to use

Should the iOS Production app signing Certificate and iOS Production Push Certificate use the same CertificateSigningRequest.certSigningRequest for push notifications to go through?
Will changing the certSigningRequest and using a new certificate still send push to my old apps.
You may use same CertificateSigningRequest.certSigningRequest for iOS Production app signing certificate and iOS Production Push Certificate. But as standard practice says, you should create different CertificateSigningRequest.certSigningRequest for for different certificates.

Push notification is not working in production certificates

I am facing issue during push notifications when app is installed on IOS(8.3) device(iPhone and iPad).
Its working locally(in development). But when I configure the same in production( upload app to app store ). It is not working.
These are the configurations that I have done:
* In Xcode, in entitlement file, for "APS environment" key i have given value as "production".
* While creating the SSL certificate i have created the production SSL certificate.
* In code i have used "withProductionDestination()" method while pushing the notification to APNS.
I am not geting any error or exceptions while sending the notification payload with token to APNS(both in production and development).
I have verified that the notifications feature is active in my account for both development and production. I have also verified the certificates and they are correct.
Can you please let me know what steps I might have missed or doing wrong?
Device token for Production (distribution) and Sandbox (developer) are different for same device.
I was also facing the same issue that push notifications were not coming in production and problem was that I was still using device id which I received in developer mode. So, I generated device id again with production certificate and notifications started to come again.
Also, make sure that you access the production environment at this URL gateway.push.apple.com with port 2195.
If you use production certificate for push notifications, you need to remove .sandbox in the apns server address and if you install the app by using Xcode, generally by using run option, then the mode will be set to development and the push notifications from production environment won't be received. You need to install the app by generating the .ipa file and install in from iTunes.
I had the same issue. PN's were working on development, but couldn't get them on production.
What helped me: Adding APNS for Distribution Certificate to Firebase.

Parse notifications not working with AdHoc provisioning profile

I know this question has been asked a few times but I am still having issues after trying all the suggested fixes.
I have an app that is being tested through Apple's TestFlight of which a number of External Users have downloaded. The app was built using an AdHoc Distribution Profile against the relevant App ID which has Push Notifications Enabled for Distribution and has the necessary Apple Push Services certificate. I am using Parse and am able to receive notifications on my test device (signed with the dev certificate and APN push cert), however the external testers are not receiving any notifications.
I am using Parse and can see in the logs that the notifications are being sent so I am assuming it is something with the devices themselves related to a problem with the provisioning profiles. I also followed the steps to uploading a new .p12 file to my Parse server for production notifications.
However, it seems that only the builds with the development profile are able to receive notifications. Am I correct in assuming that this is because the certificate used by Parse to sign the notification doesn't match that which was used in the adhoc build? I.e. Parse is still using the old .p12 certificate?
When I uploaded the new .p12 file to my Parse server I didn't explicitly remove the previous .p12 certificate, do I need to do this? Would revoking the dev APN certificate solve this?
Any help is much appreciated.
Thanks
The reason notifications were not being received was due to the production flag not being set to true when I uploaded the production certificate to my Parse server. I re-uploaded the certificate setting this to true and notifications began to work.

Setup an app to use single Universal Push Notification Client SSL Certificate for Development and Production

Recently Apple introduced a new type of APNS certificates - Universal Push Notification Client SSL Certificate.
It seemed for me that it should allow to have one certificate to use on both Development and Production (Sandbox and Production). This was really wanted feature because my backend uses the Azure Notification Hub to send pushes and contains only one available space for a certificate (Sandbox or Production).
I tried to follow official docs provided by Apple (Creating a Universal Push Notification Client SSL Certificate) but with no luck - the new certificate applies only for Distribution . And even on theirs screenshots I see that this certificate applies only for Distribution mode and not for the Development and this is what confuses me
- Creating a Universal Push Notification Client SSL Certificate
This is why I will appreciate any guidance or advice which will explain how it should work, and did I understand the purpose of those certificates properly?
That's how it should appear - "Configurable" for development and "Enabled" for distribution. But it'll work for development as well.
I had the same problem looking for how to "Generate a universal APNs client SSL certificate". After a while, I managed to make it work. In the Apple developer console:
create a Key (not a certificate)
write the name of your key a select "APNs" service.
Download your .p8 key.
Then you have to use this .p8 file in your call.

Push notifications not coming when we download the build from testflight or diawi iOS

I have successfully created the .pem and .p12 file by
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Tutorial.
We are using java as a server so I also exported my .p12 key using this link as there was an error of directly exporting the .p12 file
Cannot send push notifications using Javapns/Javaapns SSL handshake failure.
Everything is working great in debug mode. Whenever I install a build by xcode I receive the push notifications successfully everytime. But after archiving and uploading the build on testflight or diawi and then installing it on the device I didn't get any push notifications. I am successfully getting the device token from apns server. On debugging at server side we found that the device token they receive and send the notifications is invalid. This response is sent by the apns server to our java server. . I am using Xcode 6.0 or later and my app is compatible with ios7.0 or later. And yes I have made checks in registering for remote notifications for ios 8 and 7.Has anyone has faced this issue because earlier in xcode 5 series this hasn't happen. Please help
Any help will be appreciated. Thanks
If you followed Ray Wenderlich's tutorial and you made everything work in development mode, the issue most likely comes the fact that you now need to create a new .pem-file for production mode.
So, you need to perform exactly the same steps that you did with the development certificate (i.e. the .p12-file) you downloaded once more with the production certificate which you can obtain in the iOS dev center as well:
Here is the quote from the tutorial that you probably overread:
If you’re ready to release your app to the public, you will have to
repeat this process to make an Ad Hoc or App Store distribution
profile.
1.)Check if the pem file you have stored on your server is created by using a development certificate or distribution certificate, for push notifications to work through ttestflight you need to create a pem file in the distribution mode,
2.) also check if the gateway you are delivering to is gateway.push.apple.com:2195, and not the sandbox one,
3.)the notification tokens are also different for development and distribution profile, check all these scenarios and see
In order for push to work you have to use the exact same AppID for both creating APNs cert and Provisioning Profile. Wildcard profiles cannot be used for push notifications. May this be your problem(using wildcard or just different AppID for TestFlight/diawi)?

Resources