简体   繁体   中英

iOS: get all message of push notification

In my app I have push notification and it work fine.

In this method:

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {

     NSLog(@"message:%@", userInfo);
}

I can get the message of my last notification.

But the problem is that this method is called only when I tap on my alert/banner notification when app is in background mode. And it give me only the last message. When app is in background I want to save all message, is there a way to do it?

EDIT: I use Parse

No is not the right way to use push notification.

When you receive a push notification , you in any case should request to your server informations. For example new messages and info around them.

I created a social network in this way and if you see whatsapp for example, you receive also 10 push notification, then when you launch whatsapp it receives all messages... but if there isn't connection, it doesn't receive new messages because are not previously stored from push notification!

Push notification is just for the device and for advise the app that need to do something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM