我想添加文本字段来推送通知,即当应用程序在后台时我添加了几个代码到UIUserNotificatioSetting.But我没有得到文本字段来推送通知,有人可以解决这个问题吗?
发布于 2016-05-19 17:19:39
查看这篇文章,它将对你有用,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>))https://stackoverflow.com/questions/37318805
复制相似问题