-
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch./* APP未启动,点击推送消息的情况下 iOS10遗弃UIApplicationLaunchOptionsLocalNotificationKey,使用代理UNUserNotificationCenterDelegate方法didReceiveNotificationResponse:withCompletionHandler:获取本地推送
*/
// NSDictionary *localUserInfo = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];
// if (localUserInfo) {
// NSLog(@“localUserInfo:%@”,localUserInfo);
// //APP未启动,点击推送消息
// }
NSDictionary *remoteUserInfo = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
if (remoteUserInfo) {
NSLog(@“remoteUserInfo:%@”,remoteUserInfo);
//APP未启动,点击推送消息,iOS10下还是跟以前一样在此获取
}
[self registerNotification];
return YES;
} -
(void)registerNotification{
/*
identifier:行为标识符,用于调用代理方法时识别是哪种行为。
title:行为名称。
UIUserNotificationActivationMode:即行为是否打开APP。
authenticationRequired:是否需要解锁。
destructive:这个决定按钮显示颜色,YES的话按钮会是红色。
behavior:点击按钮文字输入,是否弹出键盘
*/
UNNotificationAction *action1 = [UNNotificationAction actionWithIdentifier:@“action1” title:@“策略1行为1” options:UNNotificationActionOptionForeground];
/*iOS9实现方法
UIMutableUserNotificationAction * action1 = [[UIMutableUserNotificationAction alloc] init];
action1.identifier = @“action1”;
action1.title=@“策略1行为1”;
action1.activationMode = UIUserNotificationActivationModeForeground;
action1.destructive = YES;
*/UNTextInputNotificationAction *action2 = [UNTextInputNotificationAction actionWithIdentifier:@“action2” title:@“策略1行为2” options:UNNotificationActionOptionDestructive textInputButtonTitle:@“textInputButtonTitle” textInputPlaceholder:@“textInputPlaceholder”];
/*iOS9实现方法
UIMutableUserNotificatio
IOS 推送
最新推荐文章于 2024-03-28 16:15:52 发布