Inconsistency in receiving push notification - iphone

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.

Related

Push Notifcation Woes with Titanium & XCode

I am using Titanium 2.0.2 to create an iPhone app which must, amongst other things, be able to receive push notifications. I have done the following
a. Created the AppID in my Apple Developer account
b. Configured the AppID for Push
c. Created a new provisioning profile using the newly created AppID
d. For good measure edited that profile - given that I have heard reports that the first time round it does not pick up the AppID Push info correctly
Armed with all of that I have proceeded to register my app for Push using Ti.Network.registerForPUshNotifications and coded the success, error and callback methods. I have closely followed the example in the Titanium Kitchen Sink demo.
Having done all this I had fully expected one of the following outcomes
Registration succeeds and I get the alert message I have stuck in the Success callback.
Registration fails and I get the alert message in my Error callback
Much to my surprise nothing happens at all - it is like the registerForPushNotifications call goes out into the ether and is well...gone
To be doubly sure I created a simple XCode project following the excellent tutorial at http://maniacdev.com/2011/05/tutorial-ios-push-notification-services-for-beginners/. The app registers with APNS and I trap the assigned remoteDeviceUUID using my iPad and http://itunes.apple.com/us/app/consolelog/id415116252?mt=8. I have then adapted the simplepush.php script from ManicDev and run it off my local WAMP server. It gets through to APNS and deposits my very first PUSH message. But it never arrives on my iPad!
For the sake of completeness I should mention that I am getting a development build onto my iPad with the help of TestFlightApp.
So what am I doing wrong here?
a. Why does Titanium simply not want to do anything in response to RegisterForPushNotifications?
b. Wny does my sample XCode app never get the Push notification?
I would hugely appreciate any help on this one.
A note for anyone running into this post. Beware of testing Push notifications on your iPad behind a WiFi firewall router. Most routers block access to the port used by APNS. I spent way too much time trying to find a "bug" in my code only to discover that there wasn't one. Putting the device in the DMZ on your router might help but is not reliable - at least not with my Sitecom router.
The adhoc builds that Test Flight uses are "Production" in terms of the push notifications not development ones so mostly likely your server needs to be configured with the Production APNS server keys to get it to work.

push notifications not working

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.

Apple Push notifications server - Feedback always returns zero tuples

I am developing an iPhone App that uses Apple Push Notifications. On the iPhone side everything is fine, on the server side I have a problem. Notifications are sent correctly however when I try to query the feedback service to obtain a list of devices from which the App has been uninstalled, I always get zero results. I know that I should obtain one result as the App has been uninstalled from one of my test devices. After 24 hours and more I still have no results from the feedback service..
Any ideas? Does anybody know how long it takes for the feedback service to recognize that my App has been uninstalled from my test device? Could it be due to the sandbox environment?
I have just had exactly the same problem:
int bytesReceived = 0;
byte[] feedbackPacket = new byte[38]; // Each feedback should always be 38 bytes long
bytesReceived = stream.Read(feedbackPacket, 0, feedbackPacket.Length);
while(bytesReceived > 0)
{
ProcessFeedback(feedbackPacket);
Array.Clear(feedbackPacket, 0, feedbackPacket.Length);
bytesReceived = stream.Read(feedbackPacket, 0, feedbackPacket.Length);
}
On the sandbox, the above always returned 0 bytesReceived. I ran this on the live host, sending a single notification to a device, removing the app and sending a second. The feedback service work within a second of sending the second request.
One thing I haven't found is how often to call the feedback service however. I'll calling every 10 mins at the moment.
I had the same problem with sandbox environment. Zero tuples return by the feedback service.
I switched to production environment to test my code and everything worked fine. As soon as I uninstalled the app from the device and sent a pair of push notification, this device appeared in the feedback list.
Although I can't say definetly it does not work in sandbox environment, i'm pretty sure about it. In production environment, after uninstalling my application, I sent a few (i guess 3) push notifications. Then feedback service returned results other than zero tuples. (about in ten minutes)
It is not related with this case, but also in order to get notifications and also get feedback results, your network should allow ports that APNS use.
As Zakum said in a comment, the device will not get added to the list if you delete the last push-enabled app.
(And make sure to give it enough time - maybe 10 to 20 minutes.)
From Apple Documentation:
If you remove your app from your device or computer and then send a push notification to it, you would expect to have the device token rejected, and the invalidated device token should appear on the feedback service. However, if this was the last push-enabled app on the device or computer, it will not show up in the feedback service. This is because deleting the last app tears down the persistent connection to the push service before the notice of the deletion can be sent.
You can work around this by leaving at least one push-enabled app on the device or computer in order to keep the persistent connection up. To keep the persistent connection to the production environment up, just install any free push-enabled app from the App Store and you should then be able to delete your app and see it appear in the feedback service.
Recall that each push environment has its own persistent connection. So to keep the persistent connection to the sandbox environment up, install another development push-enabled app.

Apple Push Notifications - When Registering for Notifications no Callbacks are received at all

I've gone through all the steps as specified, am using a dev certificate with APN enabled and am calling registerForRemoteNotificationTypes: with the right flags in my app delegate.
Still, neither application:didRegisterForRemoteNotificationsWithDeviceToken: nor application:didFailToRegisterForRemoteNotificationsWithError: are being called. It looks like the registration request just gets stuck in transit.
What am I doing wrong?
This sounds silly, but it's bit me in the past: double-check your capitalization and parameter types. If a delegate method declaration isn't spot on your method won't get called, and you won't get any kind of warning.
Your best bet is to copy and paste the prototype from Apple's documentation.
Try your App on another device. If it works there...
I have the same Problem with one iPhone 3G (no jailbreak, no unlock). It somply dos not work with that phone. I tried updating to a newer iPhone OS. I tried a factory reset. It does show the confirmationscreen and it records the answer in the Settings. But neither application:didFailToRegisterForRemoteNotificationsWithError nor application:didRegisterForRemoteNotificationsWithDeviceToken are ever called.
The same App works on all other tested devices (ipods, iphones). This iPhone 3G does also not receive PNs for other apps.
PNs also did not work for one Jailbroken Classic iPhone.
It might be that your device is simply not behaving correctly. Try a different device.
I had this problem too and it was because of bad certificates, app id, provision profile...
Make sure that:
1, Correct certificates are installed on client AND server
2, Make sure that you have selected correct provision profile in your project settings. REMEMBER App ID in your provision profile has to be specific(not ending with *) and last part of this App ID has to match name of your application exactly and it is case sensitive. so iv your app is called myApp then your app id has to be SOMENUMBERScom.yourcompany.myApp
Just an idea...
I had the same problem and solved it by disconnecting from the cellular network. Seems to be some problem when both wireless and 3G are on concurrently.
I found out that PUSH notifications require port 5223 open in your network (if you are using WIFI), or otherwise, a cellular data connection.
I encountered the same problem in my home network, and had to open the port manually in the wireless router.

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.