如何在iOS交互式通知中添加文本字段

问题描述:

我想开发与imessage类似的交互式通知。我阅读文档,我尝试添加多个UIMutableUserNotificationAction到UIMutableUserNotificationCategory并显示它。我想像iMessage一样显示文本字段。这是我的问题如何在iOS交互式通知中添加文本字段

UIMutableUserNotificationCategory *notificationCategory = [[UIMutableUserNotificationCategory alloc] init]; 
notificationCategory.identifier = @"Email"; 
[notificationCategory setActions:@[notificationAction1,notificationAction2,notificationAction3] forContext:UIUserNotificationActionContextDefault]; 
[notificationCategory setActions:@[notificationAction1,notificationAction2] forContext:UIUserNotificationActionContextMinimal]; 

请帮助

+3

重复的问题和回答:http://*.com/questions/25841227/adding-text-field-in-remote-notificaton-ios- 8 – Flipper

+0

谢谢@Flipper。像魅力一样工作。 – sanjayzed

let replyAction = UIMutableUserNotificationAction() 
replyAction.identifier = "REPLY_ACTION" 
replyAction.title = "Reply" 
replyAction.activationMode = UIUserNotificationActivationMode.Background 
replyAction.authenticationRequired = false  
replyAction.destructive = false 
//Set behaviour to .TextInput  
replyAction.behavior = .TextInput 
+0

请解释您的代码如何解决问题。 –