无法使UIUserNotificationActionBehaviorTextInput正常工作

时间:2016-02-08 14:37:44

标签: ios apple-push-notifications ios9

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];

这是我设置“回复”操作的方式。如您所见,我指定了所需的行为。但是,当我收到一些通知时,我将其拉下来并看到这个“答案”按钮。有什么问题?文本域在哪里?

0 个答案:

没有答案