开发者

Missing push notifications

My iPhone app's delegate has push notifications all set up:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {    
    for (id key in userInfo) {
        NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
    }    
}

Now, I launch it, then suspend by pressing the home button. I then send a notification to the device, and the notification is received. A dialog appears with two buttons - "Close", an开发者_如何学JAVAd "View". Now, when I click "View", the app gets resumed, and didReceiveRemoteNotification is sent to the delegate.

But if I click "Close", the app remains in the background. If I then manually launch the app, neither "didReceiveRemoteNotification", nor "didFinishLaunchingWithOptions" are sent. So - where is my payload? How do I get the payload in this case?


If the user closes the notification and launches the application using the app icon you won't get the payload anymore.. it is lost forever then.

This is described at http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html in the "Handling Local and Remote Notifications" section.

Also notice that the server only saves one notification for your app for a user. If the device is offline and your notification is not received but you send another one the first one will never reach the user because it replaces the first one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜