tags:

views:

426

answers:

2

Hi, my APNS notification works fine, but I have noticed a strange behavior for which I would like to ask for confirmations.

I'm retrieving the notification payload either during "didFinishLaunchingWithOptions" or "didReceiveRemoteNotification". In "didFinishLaunchingWithOptions" I'm checking

NSDictionary* userInfo = [launchOptions valueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];

in order to derive the parameters. In "didReceiveRemoteNotification" the apsInfo is derived from NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];

This works fine, with one exception: If I ignore the notification popup and tap "Close" instead of "View" and finally launch my app later on from the launchpad, there is no apsInfo anymore. Is this "by design"? Is the notification info only available, if one hits "View" or launches the app from the notification info dialog?

Regards

A: 

The same problem. Notification arrived on phone and user pressed Close instead of View on message box. A badge appear on app icon. Well done. Now, open the app and as Apple's documentation says: "use didFinishLaunchingWithOptions when you want launchOptions filled with notification and bla, bla..."

The problem is, that when didFinishLaunchingWithOptions is fired launchOptions is still empty.

Tried many combinations of solution: no result. SDK's bug?

UPDATE ===================================== In Apple's documentation is in didFinishLaunchingWithOptions written: "The dictionary is nil if the user launched the application by tapping the application icon."

So, I have no idea if it even possible to retrieve body of notification when app is launched after user closed notification messagebox (and there's badge on app icon). Is notification body lost in space when user closes notification messagebox? UPDATE======================================= After further investigation I found answer. Yes, non-delivered data are lost. No waiting for user to be online, no storage, no info of notification delivering. APNS in not payed service and Apple has no responsibility for 100% delivering of data.

Benny7500
A: 

Seems, this is the way, it is. I guess, we are all supposed to contact our servers in order to retrieve the notification payload (again). This is rather rediculous, because a notification payload is not more than 256 byte, so Apple could have provided a means to keep the notification payload for later use. At least you can retrieve the information sent to you in the "badge" element. This is saved. The rest is lost, sadly...

neil