Push Notifications stopped working after recent update - iphone

Hi I have an app on the App Store which used to receive Push Notifications perfectly but after a recent update it seems to have stopped.
I have not changed any of the notification code so I was wandering if there have been any changes in iOS 5.1 which may be causing the issue.
Anyone had a similar experience and know how to fix it?
In the application delegate I am registering for notifications:
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
and implementing the following methods:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

Related

iOS push notifications work different in different application states

I send 10 messages in row to APNS.When application is in background, I receive all of them.
But when Application is in foreground I recieve 8 notifications.
What can be a problem here?
Here is my code which is extremely simple:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
NSLog(#"Test push...");
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeNone)];
[self checkForRegisteredUser];
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
return YES;
}
Not sure will this is what you're looking for,
Here is how push notification works,
So when you application is on background, you application will never receive the push notification from the APNs but it will come to your notification tray with the message as they sent it from the server.
But if your application is in the foreground. the method in you app delegate
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
will receive the notification and will perform the necessary action as you have defined in it.
In case if you did not receive the notification you need to check the network connection.
I have developed a similar application like yours and its works well as you are expecting..

Iphone:APNS without Alert in the message

If the message is sent without alert from server,Is there any way to process that message When App is running in Foreground??
When your app is running all notifications are send to the app delegate:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

How to handle pushnotification service in iphone running app

I have implemented push notification service in iphone device, but running app will not get the notification service alert message, how to handle the APN service in running app.
Thanks in advance
Just implement in your application delegate
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
and you'll be happy =)
Implement the following code in the delegate method:
(void)application:(UIApplication *)application
didReceiveLocalNotification:(UILocalNotification *)notification
{
application.applicationIconBadgeNumber = 0;
NSString *reminderText = [notification.userInfo objectForKey:kRemindMeNotificationDataKey];
}
Also follow the link. It must help you.
http://useyourloaf.com/blog/2010/7/31/adding-local-notifications-with-ios-4.html

Which callback get executed when my app is openned from a push

Hi there i would like to know which app delegate method get called when my app launch from a push notification (When the app was previously in the background ?)
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Also check this answer.
Implement the didReceiveLocalNotification: method in your AppDelegate.
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
// Handle the notification here
}
Check the documentation of UIApplicationDelegate

How to remove the cancel ApplicationIconBadgeNumber from LocalNotification?

I am using LocalNotification in my app. It is working fine but once ApplicationIconBadgeNumber is set, not able to remove it from App. How to remove it?
You need to set the application applicationIconBadgeNumber.
For example in the application didReceiveLocalNotification.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notif {
application.applicationIconBadgeNumber = notif.applicationIconBadgeNumber-1;
}