推送
- 配置证书 - >
本地通知:
//创建通知 UILocalNotification *notify = [[UILocationNotification alloc]init];
//属性 NSDate: fireDate; NSString alertBody; NSString alertAction;
//调用通知
[[UIApplication shareApplication] scheduleLocalNotification:notify];
ios8以后 一定要获取用户权限
Application didFinishLaunchingWithOptions:... { if ([UIDevice currentDevice].systemVersion doubleValue] >= 8.0]) { UIUserNotificationSetting* setting = [[UIUserNotificationSetting...]; [application regestreUserNotificationSetting:setting]; } }
代理方法监测是否通知被点击
只有在进入前台才执行跳转
if (application.applicationState == UIApplicationStateInactive) { NSLog(@"跳转"); } 但app被杀死无法执行。
解决: 在didfinishLauch里面执行跳转:利用lauchOptions[UIApplicationLaunchOptionsLocalNotification]来判断。正常启动值为nil
同时在application didReceiveLocolNotification 函数中也要设置。来处理app没被杀死的情况