I verwendet für Remote-Benachrichtigung folgenden CodeLokale Benachrichtigung überschreiben Remote-Benachrichtigung (Actionable Benachrichtigung) Einstellung in 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)];
Dies funktioniert korrekt ist in Ordnung Show (Annehmen/Abweisen Tasten). Aus irgendeinem Zustand möchte ich App aufwachen in den Vordergrund, so folgt i lokale Benachrichtigungscode bin mit in
- (void) Anwendung: (UIApplication *) Anwendung handleActionWithIdentifier: (NSString *) Kennung forRemoteNotification: (NSDictionary *) userInfo completionHandler: (void (^)()) completionHandler-Methode.
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];
Problem: Zum ersten Mal Remote-Benachrichtigung Show annehmen/ablehnen Taste richtig, aber nach Lokalen Benachrichtigung Fern Benachrichtigung Registrierung nicht zeigen Aktionstasten (annehmen/ablehnen). Ich habe Knöpfe in Alarmen nicht gesehen?
plz diesen Link sehen http://stackoverflow.com/questions/25929665/how-to-implement-ios8-interactive-notification –
diesen Link http: //stackoverflow.com/questions/25929665/how-to-implement-ios8-interactive-notification –