iOS 通知处理,当应用未激活时

来源:互联网 发布:无法打开淘宝三级页面 编辑:程序博客网 时间:2024/06/16 16:34

如果当前app处于活动状态,走didReceiveRemoteNotification方法处理;如果是从通知中心进来,在
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法里面处理

 if (launchOptions):

    {
        NSDictionary *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
        
//        NSDictionary * dict1 = [localNotif valueForKey:@"aps"];
        //do something what u want.
//        [[[UIAlertView alloc] initWithTitle:[dict valueForKey:@"title"]
//                                    message:[dict valueForKey:@"alert"]
//                                   delegate:nil cancelButtonTitle:@"OK"
//                          otherButtonTitles:nil, nil] show];
        
        BetaTownMessage *message = [[BetaTownMessage alloc] init];
        [message setPushTitle:[localNotif objectForKey:@"title"]];
        [message setPushContent:[localNotif objectForKey:@"content"]];
        
        BetaTownMessageInfoViewController *messageInfoviewController = [[BetaTownMessageInfoViewController alloc] init];
        messageInfoviewController.message = message;
        [self.navigationController pushViewController:messageInfoviewController animated:YES];

        
    }

0 0
原创粉丝点击