如果应用未打开,则推送通知处理

时间:2013-12-03 17:49:43

标签: ios objective-c apple-push-notifications

当我的应用程序未打开(未在后台运行)时收到通知我在某处读到了我可以通过以下方式处理/访问通知:

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(@" - ");
} 

但这仅在发送一个通知时有效。如果用户收到多个,该怎么办?我怎么能处理它们?感谢

1 个答案:

答案 0 :(得分:-1)

要连续处理多个通知,您可以为每个通知存储数据,然后当应用再次打开时,会显示某种界面供用户查看每个通知。