我正在尝试在我的 iOS 应用程序中实现丰富的通知,并且在使用Notification Service Extension和Notification Content Extension时,运行我的应用程序后我收到相同捆绑标识符的错误。对于这些扩展,我是否需要使用单独的配置文件?比如我的代码一个,通知服务扩展一个,通知内容扩展一个?
6917 次
2 回答
2
是的,您必须为Notification Service Extension 和 Notification Content Extension使用单独的配置文件。作为参考,您可以使用此链接。
https://mobisoftinfotech.com/resources/mguide/ios-10-rich-notifications-tutorial/
服务扩展:
服务扩展的入口点类 UNNotificationServiceExtension
它覆盖了 2 种方法:
func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
}
func serviceExtensionTimeWillExpire() {
}
内容扩展的入口点类是 UIViewController,它实现了协议
func didReceive(_ notification: UNNotification) {
}
于 2018-06-19T10:05:40.277 回答