UIMutableUserNotificationAction *answer;
answer = [[UIMutableUserNotificationAction alloc] init];
[answer setActivationMode:UIUserNotificationActivationModeBackground];
[answer setTitle:@"Answer"];
[answer setIdentifier:@"Answer"];
[answer setDestructive:NO];
[answer setAuthenticationRequired:NO];
[answer setBehavior:UIUserNotificationActionBehaviorTextInput];
UIMutableUserNotificationCategory *actionCategory;
actionCategory = [[UIMutableUserNotificationCategory alloc] init];
[actionCategory setIdentifier:NotificationCategoryIdent];
[actionCategory setActions:@[answer]
forContext:UIUserNotificationActionContextDefault];
NSSet *categories = [NSSet setWithObject:actionCategory];
UIUserNotificationType types = (UIUserNotificationTypeAlert|
UIUserNotificationTypeSound|
UIUserNotificationTypeBadge);
UIUserNotificationSettings *settings;
settings = [UIUserNotificationSettings settingsForTypes:types
categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
这是我设置“回复”操作的方式。如您所见,我指定了所需的行为。但是,当我收到一些通知时,我将其拉下来并看到这个“答案”按钮。有什么问题?文本域在哪里?