How to test APNS for adHoc Users? - ios

I'm receiving notification in development mode but when I try to check Push Notification for AdHoc users, The AdHoc users get nothing. I' know, I'm doing something wrong but not able to figure it out. Please Help me to check APNS for AdHoc Users. Thanks in advance

First of all make sure you install production APN certificates on your server, not development certificates.
After that make sure, you are sending the notification to right server URL
Sandbox: gateway.sandbox.push.apple.com, port 2195. (for the
development)
Production: gateway.push.apple.com, port 2195. (for the release)
Still you have the same problem, try this App. APN Tester

Below link for complete step to implementation of APNS with creating of certification to test notification utility program called "PushMeBaby"
Test Push notification using PushMeBaby
May this helps lot.

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.

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.

Testflight - Universal Push Notification Client SSL Certificate - BadDeviceToken

I'm to trying to test my push notifications while utilizing TestFlight.
I can successfully receive a push notification on a device when I deploy directly to it from Xcode. However when I deploy the app to the device via TestFlight (as an external tester) I get "BadDeviceToken".
I have created a "Universal Push Notification Client SSL Certificate" and followed these apple instructions to the letter (I think). As per link:
"The client SSL certificate that is generated is a universal certificate that allows your app to connect to both the development and production environments."
Has anyone got any ideas?
Thanks
FYI:
Relevant Application Service:
iOS Certificates:
ok, this was my silly error. I am using Pushy.
You specify the environment like so:
apnsClient.connect(ApnsClient.PRODUCTION_APNS_HOST);
Unfortunately I had specified DEVELOPMENT_APNS_HOST before. It would seem that when you use TestFlight you have to specify the production apns host.
Thanks for everyone that looked over the question and answered.
You should try to re-create the certificates from scratch. Make sure that the certificates are production/distribution and not using APNS sandbox. Also, make sure it's on an actual approved device and not a simulator.
From the APNS Docs:
The specified device token was bad. Verify that the request contains
a valid token and that the token matches the environment
Also, check out these two links (first one is old):
iPhone APNS Device Tokens in sandbox vs. production
https://salesforce.stackexchange.com/questions/119615/send-push-notifications-to-ios-using-apns

issue testing push notification with a distribution certificate

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.

APNS on EC2 not working

I have APNS setup on my dev environment and everything works flawlessly. In production, I can see that devices are being registered and I see the deviceToken in my database and I see that messages are being sent...but users are not receiving them. Is there anything for security groups that have to be done here? I tried reading the below:
Apple push notification server on Amazon EC2 connected but not receive notification
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html
I tried to telnet to gateway.push.apple.com and i was able to... Is there anything else that I am missing??
EDIT
My server logs are fine, and after tons of debugging seems like the issue has to be with APNS. Can somebody please tell me if my setup is ok?
I'm using the dev provisioning profile and im testing in a prod-like environment (but still not prod) with the prod apns certificate and key. Is this not allowed? Am I not allowed to use the dev provisioning profile to test it myself this way?
Your certificates should match up. You can't use the production APNS cert/key to send to development provisioning profiles, and vice versa.
From the documentation on push notification provisioning:
Each certificate is also limited to one of two development environments, each with its own assigned IP address.
You must get separate certificates for the sandbox (development) environment and the production environment.

Resources