issue testing push notification with a distribution certificate - ios

I am following this tutorial: http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Now with development certificate works fine, but I'm getting crazy to test with the distribution certificate!
I did the same thing only using the .p12 and the relative distribution certificate instead of development, but that will never get the notifications!
Maybe I'm missing something .. could someone kindly explain how you can test push with the distribution certificate?
The app is already on App Store.
Thanks
EDIT
I solved it by creating an ad-hoc distribution, but now I have another problem:
if i test my php code from terminal in my desktop everything works fine. but if I try to upload php and .pem file to my server, the push notification stop to work!!!
maybe I change the path of ck.pem in php code?

For production environment, please use gateway.push.apple.com:2195 push notification server in the simplepush.php (instead of gateway.sandbox.push.apple.com:2195). Please see the Provider Communication with Apple Push Notification Service article for more information.

Related

Apple push notification for production in iOS not working

To start with the problem, the push notification certificates in the backend was set-up by another developer and was perfectly working fine. However, the developer has left and as I do not have access to his machine hence I created new distribution certificates to upload the new version of the app, which then stopped the push notifications to get delivered. I'm working with push notifications for the first time and quite confused where the problem lies. Can anyone give me a clear picture what is happening and how to go about it?
Here's what I did after it stopped working. I went to the developer portal, and as it was showing push notification was enabled hence,
generated a code signing request or CSR file in my mac
downloaded the aps.cer file
created .p12 and .pem file
After this, I have provided both the .p12 and .pem file to our backend guy, but still, it was not working on our test flight builds.
I then tested using Pusher application which was available from GitHub and it successfully delivers the push notification to the test flight build using production certificates.
Hence can anyone give me a clear idea, where I could have gone wrong?
Do I need to revoke my push notification SSL certificate and generate again? or what could be the possible mistake?
If it is working using any online tool such as pusher, then it should work fine from code as well. your developer is missing something, Ask him to check configuration properly. he must invoke production APNS url/port if it is production certificate and production app. he must invoke sandbox APNS url/port if it is sandbox certificate and sandbox app. Below url/ports are used for APNS(assuming you are using directly APNS instead firebase)
SANDBOX_GATEWAY_HOST = "gateway.sandbox.push.apple.com"
SANDBOX_GATEWAY_PORT = 2195
SANDBOX_FEEDBACK_HOST = "feedback.sandbox.push.apple.com"
SANDBOX_FEEDBACK_PORT = 2196
PRODUCTION_GATEWAY_HOST = "gateway.push.apple.com"
PRODUCTION_GATEWAY_PORT = 2195
PRODUCTION_FEEDBACK_HOST = "feedback.push.apple.com"
PRODUCTION_FEEDBACK_PORT = 2196
Also make sure these url are reachable from your server, try to send a push notification from server using curl command and debug if still issue persist. Keep in mind proxy also if you using.
Just answering here so that it can be helpful to someone else. Everything was set up as accordingly, however, the problem was 'Sandbox' key in the server was set to 'True' for even production. Once we turned it false, everything worked perfectly.

Pushnotification not received when install ipa file

Pushnotification not received when install ipa file using developer mode.
Two days before it was work fine.
I am able to receive pushnotification if install via Xcode. But, not receives after makes ipa file (Budle Id and code signing part is correct).
I have tested the following websites too,
http://pushtry.com/
http://apns-gcm.bryantan.info/
When you take build from Xcode it will be development mode. And you stated "I am able to receive pushnotification if install via Xcode".So that means in server side development APNS certificate is implemeted and the certificate is valid.
So check following:
1) While taking IPA file(archiving), are you taking development build (see ).
If you take other builds then you need to implement distribution APNS certificate in the server, coz the IPA will be distribution/production build.
Things to Consider in Push Notification
Development Mode , Certificate in server must be development. And send push to tls://gateway.sandbox.push.apple.com:2195
Any mismatch will cause push not receiving issue.
https://apn-tester-free.en.softonic.com/mac
you can use this app for testing development.

App Boy iOS implementation

I have implmented appboy in iOS app for push notifications.
This was working fine previously but from last two days its giving an error when I am trying to test a push.
"None of the users with email or id asd111#gmail.com have matching push tokens for iOS Push"
And previously everything was good and working fine.
same p12 certificates same pem. Any suggestion would be helpful.
I was facing same issue a while ago and ended up uploading another p12 certificate. It worked like a charm ;). Also make sure you are testing in the same environment for which appboy is configured for! I mean, if you are using development certificates to test push notifications than you must upload development SSL certificate (p12) and if you are using distribution certificate than you must upload production SSL certificate. Hope it helps!

APN works in development not in distribution

We have an iPhone app that uses APN, the testing was perfect on sandbox, now the problem we are seeing is that APN is not reaching the phone on production, is this a known issue on the iPhone? Our app was just approved two days ago.
We checked everything mentioned here,
I understand this question is very hard to answer and I guess what I'm looking for is any hints.
This is what I made sure of:
I am using different APN token for production than development
The provisioning profile has Push Notifications enabled
Apple APN service responds successfully without and don't report any issue.
Certificates seems to be fine. And when I unzip the ipa I see aps-environment refers to production in the distribution ipa.
Downloaded the Store ipa and unpacked it, yet to find that it also has the aps-environment set to production.
UPDATE:
I removed all the certificates and provisioning profiles and created a new Production/Distribution certificate with Push Notification support.
Now, when I installed the store version, the APN didn't work still. However, I used the latest Ad-Hoc built I have locally and the APN is working fine. I decided to replace the Ad-Hoc with the Store version, and behold, the APN started to work. I am not sure what's the issue, I'll have to check on other phones to see if it really works. Have anyone had similar scenario?
Old question, but I had the same troubles.
Just found this link: iPhone iOS push notifications apns on production not sending
For production you need a different URL to push your notifications:
ssl://gateway.sandbox.push.apple.com:2195 Development
ssl://gateway.push.apple.com:2195 Production
This fixed it for me.

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