I'm developing an app, I'm using push notifications, I'm sending pushes from an asp.net application and everything is ok, but there is a problem when I want to catch the notification message in the xcode. I know to catch that information I have to use this method
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
But it works just when the user tapes "view" in the alert or when the app is in foreground. I need to save the message in to my core data DB everytime, but I can't do that if the user tapes "close" in the alert. Are there any way to get a solution for my problem?
Thanks.
If the application is in the foreground, then yes, your code can automatically be notified. If your app is not running, or running in the background, the user must "view" the notification.
ReplyDeleteHowever, you can include an update to the app's icon badge number in the push notification. The app could check that periodically. After pulling the data, the app should then reset its badge icon number.
Inerdial's comment is also correct. The app should pull the data as needed after it receives the notification.