我正在开发一个应用程序。这将有交互式通知。如果应用程序收到推送通知并且应用程序没有在前台运行,那么用户应该能够通过通知中心的通知进行回复。我想添加文本字段以从用户获取文本,并添加回复按钮以将该文本发送到应用程序。
知道怎么做吗?我可以通过 UIMutableNotificationAction 类添加按钮。但找不到添加文本字段的方法。
最佳答案
适用于 Xcode6 GM 和 iOS8 GM 版本。没有选项可以将文本字段添加到交互式**通知。
NS_CLASS_AVAILABLE_IOS(8_0)
@interface UIMutableUserNotificationAction : UIUserNotificationAction
// The unique identifier for this action.
@property (nonatomic, copy) NSString *identifier;
// The localized title to display for this action.
@property (nonatomic, copy) NSString *title;
// How the application should be activated in response to the action.
@property (nonatomic, assign) UIUserNotificationActivationMode activationMode;
// Whether this action is secure and should require unlocking before being performed. If the activation mode is UIUserNotificationActivationModeForeground, then the action is considered secure and this property is ignored.
@property (nonatomic, assign, getter=isAuthenticationRequired) BOOL authenticationRequired;
// Whether this action should be indicated as destructive when displayed.
@property (nonatomic, assign, getter=isDestructive) BOOL destructive;
@end
请参阅以下链接了解更多详细信息:
关于ios - 如何在 iOS 8 的交互式通知中添加文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25179758/