您的位置:首页 > 移动开发

本地通知启动 app 的状态

2016-06-27 12:33 489 查看
/** 程序从杀死到接收到消息打开通知的操作 */

- (void)DYApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    /** 程序杀死到启动 */

    if (launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]){// 程序关闭 点击程序图标启动程序

        

        /** 取到通知 */

        UILocalNotification * local = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];

        [self PushWithIdentifiers:local.userInfo[DYIdentifierKey]];

    }

    

     UILocalNotification * local = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];

     [self PushWithIdentifiers:local.userInfo[DYIdentifierKey]];

    

}

/** 程序从后台接收到通知到前台的操作 */

-(void)DYApplication:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{

    

    if (application.applicationState == UIApplicationStateActive) {/** 程序在前台 */

//        [self alertWithTitle:@"前台接收到了通知"];

    }else if (application.applicationState == UIApplicationStateInactive){ /** 程序充从后台到前台 */

       

        /** 根据数组的主播个数的不同 跳转不同的页面 */

        [self PushWithIdentifiers:notification.userInfo[DYIdentifierKey]];

        

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: