Ios 应用未打开时推送通知处理
wen我的应用程序未打开(未在后台运行)时收到通知。我在某个地方读到,我可以通过以下方式处理/访问通知:Ios 应用未打开时推送通知处理,ios,objective-c,apple-push-notifications,Ios,Objective C,Apple Push Notifications,wen我的应用程序未打开(未在后台运行)时收到通知。我在某个地方读到,我可以通过以下方式处理/访问通知: NSDictionary *tmpDic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"]; //if tmpDic is not nil, then your app is launched due to an APNs push, therefore check this N
NSDictionary *tmpDic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
//if tmpDic is not nil, then your app is launched due to an APNs push, therefore check this NSDictionary for further information
if (tmpDic != nil) {
NSLog(@" - launch options dict has something ");
NSLog(@" - badge number is %@ ", [[tmpDic objectForKey:@"aps"] objectForKey:@"badge"]);
NSLog(@" - ");
}
但这仅在发送一个通知时有效。如果用户收到了多个呢?我怎么处理他们?感谢连续处理多个通知,您可以存储每个通知的数据,然后当应用程序再次打开时,显示某种界面供用户查看每个通知。当应用程序甚至未运行时,不会调用Dod receive push notification方法。如何捕获和保存通知,以便在应用程序未运行时稍后加载它们?