如何在iOS 8中实现iOS 9中的UIUserNotificationActionBehavior.TextInput?

时间:2015-09-26 08:45:47

标签: swift ios8 apple-push-notifications ios9

我已注册UIMutableUserNotificationAction

let responseTextAction = UIMutableUserNotificationAction()
responseTextAction.identifier = "text"
responseTextAction.title = "New text"
if #available(iOS 9.0, *) {
    responseTextAction.behavior = UIUserNotificationActionBehavior.TextInput
} else {
    // Fallback on earlier versions
}

这是来自iOS 9的截图:

enter image description here

来自iOS 8:

enter image description here

如何实现iOS 8的文本输入。

1 个答案:

答案 0 :(得分:1)

通知的文本输入仅适用于iOS 9+。如您所见,以前的版本将默认为标准通知。