Iqb*_*han 26 iphone cocoa-touch objective-c push-notification ios8
我想在我的iOS应用程序中添加工具,用户可以直接从推送通知回复我的消息.就像iMessage应用程序在iOS 8中一样.我可以添加按钮来推送通知,但没有找到任何有关如何添加文本字段的指南.请帮忙.提前致谢.
-------------------------------------------------- ----------------------------------------
我知道如何添加操作(按钮),但如何添加文本字段或文本视图以进行输入
Sat*_*ran 11
你无法在iOS 8或更低版本中执行此操作,但iOS 9也可以这样做,我写了一篇关于相同的博客文章.这很简单,
//creating the inline reply notification action
let replyAction = UIMutableUserNotificationAction()
replyAction.title = "Say Something"
replyAction.identifier = "inline-reply"
replyAction.activationMode = .Background
replyAction.authenticationRequired = false
replyAction.behavior = .TextInput
//creating a category
let notificationCategory:UIMutableUserNotificationCategory = UIMutableUserNotificationCategory()
notificationCategory.identifier = "INVITE_CATEGORY"
notificationCategory .setActions([replyAction], forContext: UIUserNotificationActionContext.Default)
//registerting for the notification.
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes:[ UIUserNotificationType.Sound, UIUserNotificationType.Alert,
UIUserNotificationType.Badge], categories: NSSet(array:[notificationCategory]) as? Set<UIUserNotificationCategory>))
Run Code Online (Sandbox Code Playgroud)
我能够像下面那样得到它,
归档时间: |
|
查看次数: |
5625 次 |
最近记录: |