远程推送,在前台和后台时进入时 方法为  -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{

在完全退出时走得方法为  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  //推送
    
    if (launchOptions) {
        NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
        NSInteger type = [userInfo[@"type"] integerValue];
        NSString *notiContent = userInfo[@"aps"][@"alert"];
        NotifiCationDao *dao = [NotifiCationDao new];
        [dao addNotiWithContent:notiContent type:type];
        [[NSNotificationCenter defaultCenter]postNotificationName:kDidReceiveRemoteNotificationKey object:userInfo];
        
    }

posted on 2015-09-18 11:37  火星的蝈蝈  阅读(166)  评论(0编辑  收藏  举报