ios apns not sending consistently to devices - ios

Good day people!
I started having this problem last month when the registered devices on my app stopped receiving push notifications
At first I realized that it was because Apple dropped SSL v3 support so I performed a git pull of the pyapns update.
Push messages started sending properly again, but are not being received. The push server logs are returning few malformed payload errors, but the occurrence of a successfully sent notification is very low, and sometimes being sent in batches.
After rebuilding the push certificate, push messages started being sent on time, and successfully, but this only lasted for a few hours.
As of now, a direct push notification test request to my server is not even being delivered to test devices properly, which was not the case a few hours back.
This is my setup:
All push messages are queued via Resque.
Actual server pushing the payload is 'pyapns.'
Push server OS is Ubuntu 14.04.1 LTS.
Upon checking logs on my service, Resque, and pyapns, I was very sure that I am successfully sending the payload to the Apple push servers. There are no malformed payload responses from APNS, but still, no messages.
Push certificate is recently updated and is being used by server running pyapns.
A quick peek at the server shows that a copy of Entrust CA Root Certificate is installed (as per requirement for TLS connections, specified by Apple).
Can anyone help me in this problem? Thank you!

How did you
I updated my push server application to use TLS instead.
PyAPNs should auto switch to TLS without any further configuration. Please refer to PyAPNs TLS support, it contains openssl test command as well :)

Related

iOS Push Notification not being sent from linux server

I currently have an application that sends push notifications to APNS, if I run this application locally on my computer (where i do my development) it sends the push notification without any error, however once i put the application on my linux server the exact same code with same device tokens fails to send and receives a "BadDeviceToken" error from APNS.
What would cause me to get this error on my server but not on my local computer? The .p12 certificate I have on my server is taken from my development APNS cert in my keychain on my local computer.
Any suggestions would be very helpful!
So I didn't realise that using Test flight actually requires production apps certificates.
Changed to using them and it all worked, apple should really have a different error message for that case so people don't spend all that time debugging the device token...

Bluemix Push Notification service not working anymore?

I have a native iOS Swift app talking to a Node.js Bluemix backend with MobileFirst services (AMA, Cloudant, Push iOS 8), which worked well for over a month. A few days ago I noticed that I could no longer register new devices from the iOS app (IMFPushClient.sharedInstance().registerDeviceToken() responded with a 404).
I knew that changes had been made recently to the MobileFirst services (e.g. the various push services were merged into one), so I figured I should rebind those services. This resolved the registration issue, but I haven't been able to receive push notifications ever since.
This is what I tried:
created a completely new backend with the "MobileFirst Services Starter" boilerplate
cloned the most recent version of the "Bluelist" sample app and configured it for this new backend
issued a new APNs certificate for my bundle ID and uploaded it to the push service
successfully registered for push notifications on my device. I have verified this by calling the /devices REST API (essentially, I followed these steps).
Now every time I use the REST API to send messages (after figuring out that the bearer token approach was replaced with a new "appSecret" header), I get an HTTP 202, but the notification never arrives. Likewise, when I try to send the message through the service's dashboard, I get a success message, but the notification never arrives.
One thing I noted is that the symptoms stay the same even if I don't provide the .p12 certificate to the service, so I wonder if this might be some certificate issue, but I have no idea how to trace this. Also, IIRC the "old" MobileFirst services required me to provide the bundle ID and version of the mobile app, but this seems to be gone now. Any help is greatly appreciated.
We were able to solve the issue above by making sure the sandbox environment was using a sandbox .p12 file. To verify this setting go to the IBM Push Notification Dashboard and click the Configuration tab:
Here you can see the Certificate Type of the .p12 file you have uploaded. Make sure if you are using the Sandbox environment it is listed as Sandbox. Same is true for the Production environment.

APNS Push Notifications not being delivered to *some* devices

I developed a web API for my mobile app use it.
This API was developed with Django, and I'm using the django-push-notifications lib to handle the push notifications.
The push notifications were working fine for all the devices, until it stopped working for few of them, which worked at some point, for no apparent reason.
I already debugged the server and I can see the messages being sent to APNS and on the correct format. Also reviewed the certificates, and all is working as it should. I'm using the production certificate sending to the appropriate server.
I'm sure that this is not a problem with certs, since some other phones receive the notifications.
Where should I start looking for the problem now?
Thanks.
They are not reliable! There is no guarantee that push notifications will actually be delivered, even if the APNS server accepted them.
As far as your server is concerned, push notifications are fire-and-forget; there is no way to find out what the status of a notification is after you’ve sent it to APNS. The delivery time may also vary, from seconds up to half an hour.
Also, the user’s iPhone may not be able to receive push notifications all the time. They could be on a WiFi network that does not allow connections to be made to APNS because the required ports are blocked. Or the phone could be turned off.
See this link
Are you sure that those some devices does't have a development version of app ?
Try to generate a combined p12 certificate of apn development certificate and apn production certificate , than try to call gateway.push.apple.com and gateway.sandbox.push.apple.com separately.

iOS Push Notification service batch size

We are trying to send a notification to ~500,000 iOS devices. We have currently set the batch size to 200 and are noticing that Apple refuses our connection after 300k messages or so. We suspect that Apple interprets our connection/tear-downs to be a DOS attack. What is a good batch size for us to use? Also, any tips on sending notifications for such a large number of devices?
Your push notification server must maintain a persistent connection to Apple's socket stream push server without disconnecting too often.
I recommend writing your push server using Node.js, it was designed for this stuff.
However there are a few things that can also cause Apple to disconnect your push server.
With Push Notification, there are two types of certificates - development and production.
An app signed with a development certificate will generate a development push token whereas a an app signed with a production certificate will generate a different production push token even on the same device.
Your server must make sure it does not send a development token to a production socket stream connection to Apple's push server.
Mixing the token and environment will cause Apple's push server to disconnect your push server.
How you separate your push token is something that you need to build into your server.
Hope that helps.

How to debug if the message went through Apple Push Notification Service?

I am experimenting with Apple Push Notification Service with node.js as server. So far I've got it to work and when it works, it works as intended.
However, sometimes the message doesn't arrive. I am not sure if this is natural (maybe I have bad connection and the message is not coming through because of that), or if it's a bug in my code. The situation is really random. Sometimes it comes through and sometimes it doesn't, even though I didn't change the code or anything.
I am using node-apn (https://github.com/argon/node-apn), and according to the debug console, it's being registered as successfully going through--at least from the server side. Here's the debug message:
apn Initialising connection +19s
apn Initialising module +1ms
apn Connection established +383ms
apn Sending notification +0ms
apn Socket drained +1ms
apn Socket writeable +0ms
This message appears both when the message goes through and when it doesn't go through. So I guess node-apn itself is doing its job all right. Which means it's either:
There's something happening between my server and apple push server
There's something happening between apple push server and my iOS device
But I don't know how to find out what's happening. So what I am trying to find is a solution to:
Find out if my push notification is being registered by APNS
Find out if APNS is sending out all the notifications to my iDevice
Anyone know how to do this? Thank you so much!
There is a well written technical note from Apple about the different sources of problems with the push notification services:
http://developer.apple.com/library/ios/#technotes/tn2265/_index.html
Use tcpdump on ports 2195, 2196 and 5223, as data pass over them:
http://support.apple.com/en-us/HT202944
Use Wireshark to read the dump files:
http://redmine.streamco.org/projects/smartswitch-public/wiki/Debug_VoIP_call_with_Wireshark

Resources