我们如何在目标 c 中添加文本字段来推送通知? [复制]
Posted
技术标签:
【中文标题】我们如何在目标 c 中添加文本字段来推送通知? [复制]【英文标题】:How can we add textfield to push notification in objective c? [duplicate] 【发布时间】:2016-05-19 09:13:13 【问题描述】:我想添加文本字段来推送通知,即当应用程序在后台时。我向 UIUserNotificatiosetting 添加了几个代码。但是我没有让 texfield 推送通知,任何人都可以解决这个问题吗?
【问题讨论】:
【参考方案1】:查看这篇文章,它将对您有用 Adding text field in Remote Notificaton, iOS 8
//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>))
【讨论】:
以上是关于我们如何在目标 c 中添加文本字段来推送通知? [复制]的主要内容,如果未能解决你的问题,请参考以下文章