push notifications not working - iphone

I know this question has already been asked but I am in urgent need of the answer.
I was implementing push notifications in my app.
Initially everything was working fine and I was getting alerts.
But one day my certificate expired and I renewed the cert and used the updated p12 file.
I regenerated the pem files. But now I stopped getting alerts.
I thought that may be I there could be some issue with p12 files so I regenerated them several times. But push notifications don't work.
Please suggest something to resolve this issue.
Thanx in advance.

May be the ports for sending the push notification are closed on your machine.
Check with the ports specified in apple push notification guide.

I got the solution for my problem.
According to apple docs sometimes due to impersistent connection the device is not able to connect with APNS.
So for this you need to on-off Notifications from the Settings app frequently so that the connection is regained with APNS.
Hope this saves a lot of time of many people stuck in this issue.

Related

APNS - can't get even one push notification

Can somebody tell me if you get push notifications?
I think there is a problem with APNS because yesterday everything worked fantastic, no changes were made and today I can't get even one push notification.
Will be happy to hear you answers.
Thanks
So I fixed the problem and now everything works just fine.
The problem was with .pem file.
You can use this url for getting correct pem file:
https://pushio.zendesk.com/entries/21644287-generating-a-pem-file-for-ios

Is a server required for push notifications?

Just to start I, I want to say I have read the this tutorial: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
After reading it, had a few questions about push notifications... my main questions is, is a server required.
I have made an app that has informational content for my business... however every week/month or whenever I choose, I want to be able to push a message to all the user who have downloaded my app (every device would receive the same message).
Preferably, the way I would want to create and send the notifications... is through a separate app that I, the developer only has.
Now back to my question, would I need to get a server to do this?
There are a lot of free Push Notification servers - for example QuickBlox
You don't need any server code, QuickBlox already wrote all for you.
Just look at Push Notifications iOS sample - This sample enables you to send notifications and alerts to users at any time through an API or easy-to-use admin panel.
Just download it, move some code from it to your app - and enjoy it.
We use a framework called Parse that let's us send broadcast pushes to all users. You don't need to maintain a server (they do it for you). It's free for under 5 million queries a month.
No you dont need a server, you can simply create your own application that connects to the apple push notification server but you have to ensure you use the required develop/publish certificate for the ssl connection, you can see that on the tutorial you read in the "Making a PEM file" secction. He is connecting directly from his mac to the servers, it fails without the certificate but it doesnt with it.
See here:
As I’ve mentioned a few times before, you need to set up a server that
sends the push notifications to your app. For this first test, we’re
not going to set up a server just yet. Instead, I’ll give you a very
simple PHP script that sets up a connection to APNS and sends a push
notification to a device token that you specify. You can run this
straight from your Mac.
You can make your program set up a connection like that.

Inconsistency in receiving push notification

I found some weird behavior in push notification. My iPod app receives push notifications till last week with no issues. Then I found that my app is not receiving push notifications, and I changed the certificates and it worked fine, and after 2 days its not working. And I repeated the same process and same kinda problem. I was wondering why this happens?
NOTE I am using my own java based server to send push notification. I am sure that my certification are not expired. At the time of this problem the badge id is also not visible with my application icon.??
Thanks in advance.
Ensure a few things
You are using the correct combination of production or dev pem and the APNS or sandbox server URL
Check the Feedback services to ensure whether you are getting any errors
I faced similar issues with my 3GS running OS 4.1 last week. It started working after I restarted my device. Try doing that and see if it works.
Please make sure to update the device token in the database of you provider. I guess some updates in your iOS/certificates may changed your device token. Just make a test around that.
Try lostInTransit's solution and also check for your internet connectivity. I also faced this issue with my iPod sometimes the push notifications not come in my iPod. Try this -
Install facebook iPhone app on your device.
Send a test push notification from your server.
If the notification does not come then do something with facebook which should generate the notification.
If the notification from facebook does not come it means its related to your net connectivity.And your code is perfect.
Sometimes I see that when my iPod is on DHCP it does not receive the notification but when I assign it a static network (dedicated IP) it works fine.

Issues with receiving push notifications -

I have a problem where I don't receive notifications every time I push them to the device. I do receive them occasionally or after a big delay. I'm using the development certificate for APNS and Ruby on Rails on the server side. The server does send notifications to the Apple server its only when I'm receiving them I have a problem.
I initially thought it was a problem with global notifications (tunnel being closed) and to test it I sent my device a notification to Skype which was received almost instantaneously. So, I really dont understand whats the problem here. Is there anything I'm missing or how do I trouble shoot it in depth.
Are push notifications reliable and whats the latency involved? Any help will be greatly appreciated. Thanks
In development, the sending of push notification is not reliable. Some notifications may arrive with some delay. You can try to send notifications in production by building your app in adhoc.
If you haven't the same result with different iphone/ipod, you can try to reset network settings device.

Apple Push Notification Service - notification messages aren't sent to iphone device

I constructed provider code with using C# and it was able to send notification messages to iphone devices successfully. But since yesterday, it hasn't worked. Also it seems to connect APNS successfully and send notification message. Unfortunately, no notification message is received by iphone device. I controlled internet connection and device token of iphone device. What else can I do? Thanks in advance...
I dont have enough rep to comment on the question so typing out answer - Please add more details and I will edit my answer.
Is this in a developer / testing environment and are you using an ad hoc profile to install the application on the iphone devices?
Did you check if the device token has changed and that you are using the new/ correct token in the C# code?
Do provide more details of your problem.
Crazywood, I don't have a solid answer for you but I can tell you I'm in the same boat as you.
There are times when all my notifications go through and times when none of them seem to.
One guess is that not all notifications are sent. According to the docs, in production remote notifications are not guaranteed to be received by the client. My guess is that this is also the case for the sandbox.
-------- EDIT ------
I went through the trouble shooting list (http://developer.apple.com/library/ios/#technotes/tn2010/tn2265.html) and came across this:
The device may have lost its persistent connection to the push service and can't reconnect. Try quitting the app and relaunching it to see if registration completes the next time. (On iOS 4 and later on devices that support multitasking, you will need to force quit the app from the recents list.) If the registration does not complete, iOS has been unable to re-establish the persistent connection. You can troubleshoot this as described in the previous two sections.
I restarted the app and it made no difference. Then I rebooted my phone. That seemed to do the trick.