APNS on EC2 not working - ios

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.

Related

Is the Apple Push Notification service SSL (Sandbox & Production) certificate universal?

I read a lot about certs and watched a WWDC, but should clear for myself and for others next question. When we creating certificates in the developer portal, we see next possibilities:
So, what is the purpose of creating only Sandbox certificate instead of Sandbox&Production one? Also there is two fields in app description for certificates.
Does it is a rudiment and we can use only S&P certificate or we should also implement development cert?
After some investigation, I didn't find cases were needed only Sandbox Certificate. It seems, that it's a rudiment. You can generate only one cert for Sandbox & Production and use only it for both environments.
Well just right now every Samsung phone got a push notification with a title of 1 and body of 1.
https://www.theverge.com/2020/2/20/21145130/samsung-find-my-mobile-app-1-notification-galaxy
Why? I guess because the person was testing how remote notifications work. Just that he was using the production certificate and it got sent to every Samsung user.
So it's certainly safer to be using the sandbox version to test things initially with your debug builds ie build that have used your development certificate.
You won't run into an issue when you're working with a tool that you require a given device token e.g. see Push Notification Mocker. But if you give this production certificate to your QA server and QA server sends tries testing out a 'send to all users' notification then such a cluster mess will happen.

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.

Push notification is not working with iOS9 and above

I have tried these bellow ways:
I noticed was the Device Token gets changed for every fresh install which is kind of weird as we have to update the server for every new instance. Now i have fixed with save UUID in keychains.
I have created development provision and check. But not getting any luck.
I have created Adhoc provision and check. But still not getting PN.
Depending on how you distribute your app you may either be on the sandbox or the production server. Your token will only work for the server that the app is provisioned for.
Additionally, the machine that you're sending push notifications from will need to have the correct certificate and key to interaction with the APNS servers.
One thing to watch out for is using the same Certificate Signing Request for both the development and production APNS certs, some services won't properly send if they detect the wrong certificates in a .p12 file and keychain access will export more than two items if you used the same CSR.

iOS Push Notifications not working with Development certificate

Situation: we have PROD and DEV APN certificates installed on different backend URLs. PRODUCTION certificate works!: pushes are delivered.
DEV certificate does not work, apple servers return error code 7 (invalid token). I have already checked all the stuff but may be I'm still missing something.
app id is correct (same used for prod)
i use right backend (with DEV certificate installed)
I start the app from XCode in DEBUG mode (corresponds to DEV environment)
I use proper app development certificate, from the same account
I use proper dev profile (pushes are supported in it)
Should actually work, right?
In case of IOS 9, please send notifications from Apple Production Push notification certificate, it will work.
Make pem file from Production APS certificate, and use this file both in development as well as production mode.
Moreover, use gateway of production in both cases which is "gateway.push.apple.com:2195"
Don't use "gateway.sandbox.push.apple.com:2195" even if you are sending notifications in development mode.
The device token returned by the phone for push notifications is different in production and development. Make sure that your server uses an actual development device token (I'm not talking about the certificate but about the device identifier) when making a request to APNS.
If your device already run the production build of your app, the production token may be in your database and your server may try to use it. Depends on how you handled your user accounts though.

How to test APNS for adHoc Users?

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.

Resources