我注册了:

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的截图:
swift - 如何在iOS 8中从iOS 9实现UIUserNotificationActionBehavior.TextInput?-LMLPHP
从iOS8开始:
swift - 如何在iOS 8中从iOS 9实现UIUserNotificationActionBehavior.TextInput?-LMLPHP
如何实现iOS 8的文本输入。

最佳答案

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

07-26 09:37