1
は、私は、リモート通知ローカル通知オーバーライドiOS 9のリモート通知(実行可能通知)の設定ですか?
UIMutableUserNotificationAction *action1;
action1 = [[UIMutableUserNotificationAction alloc] init];
[action1 setActivationMode:UIUserNotificationActivationModeBackground];
[action1 setTitle:@"REJECT"];
[action1 setIdentifier:NotificationActionOneIdent];
[action1 setDestructive:NO];
[action1 setAuthenticationRequired:NO];
UIMutableUserNotificationAction *action2;
action2 = [[UIMutableUserNotificationAction alloc] init];
[action2 setActivationMode:UIUserNotificationActivationModeBackground];////UIUserNotificationActivationModeBackground
[action2 setTitle:@"ACCEPT"];
[action2 setIdentifier:NotificationActionTwoIdent];
[action2 setDestructive:NO];
[action2 setAuthenticationRequired:NO];
UIMutableUserNotificationCategory *actionCategory;
actionCategory = [[UIMutableUserNotificationCategory alloc] init];
[actionCategory setIdentifier:NotificationCategoryIdent];
[actionCategory setActions:@[action1, action2]
forContext:UIUserNotificationActionContextDefault];
NSSet *categories = [NSSet setWithObject:actionCategory];
//Right, that is the point
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
UIUserNotificationTypeSound | UIUserNotificationTypeAlert categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
//register to receive notifications
[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
これは罰金ショーの正しい(許可/拒否ボタンを)働くために、次のコードを使用していました。 (のUIApplication *)アプリケーションhandleActionWithIdentifier:(NSStringの*)識別子 forRemoteNotification:(NSDictionaryのいくつかの条件のために、私はので、私は
- に(無効)アプリケーションを次のローカル通知コードを使用していますフォアグラウンドにアプリを覚ますたい*)userInfo completionHandler:(void (^)())completionHandlerメソッド。
UIMutableUserNotificationAction *action1;
action1 = [[UIMutableUserNotificationAction alloc] init];
[action1 setActivationMode:UIUserNotificationActivationModeForeground];
[action1 setTitle:@"LAUNCH"];
[action1 setIdentifier:@"OPEN_ACTION"];
[action1 setDestructive:NO];
[action1 setAuthenticationRequired:NO];
UIMutableUserNotificationCategory *actionCategory;
actionCategory = [[UIMutableUserNotificationCategory alloc] init];
[actionCategory setIdentifier:@"LOCAL_NOTIFICATIOn"];
[actionCategory setActions:@[action1]
forContext:UIUserNotificationActionContextDefault];
[actionCategory setActions:@[action1]
forContext:UIUserNotificationActionContextMinimal];
NSSet *categories1 = [NSSet setWithObject:actionCategory];
UIUserNotificationSettings *settings2 = [UIUserNotificationSettings settingsForTypes:
UIUserNotificationTypeSound | UIUserNotificationTypeAlert categories:categories1];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings2];
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate date];
localNotification.alertTitle= @"Security settings enabled,";
localNotification.alertBody = @"tap the Launch button to start the application";
localNotification.category = @"LOCAL_NOTIFICATIOn";
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
問題:初めてリモート通知ショーのは、(許可/拒否)/正しくボタンを拒否受け入れるが、ローカル通知リモート通知を登録した後でないショーのアクションボタンを行います。アラートのボタンが見えませんか?
プラザhttp://stackoverflow.com/questions/25929665/how-to-implement-ios8-interactive-notificationこのリンクを参照してください –
このリンクhttpを参照してください。 //stackoverflow.com/questions/25929665/how-to-implement-ios8-interactive-notification –