【发布时间】:2018-02-08 07:34:34
【问题描述】:
我想知道我们应该在 swift 3.0 中使用哪个委托函数而不是:
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
用于处理通知,因为此委托功能已弃用。我也检查了这个链接: UILocalNotification is deprecated in iOS10 但没有找到接收代表。 如果我使用相同的委托函数,则不会调用委托。
谢谢。
【问题讨论】:
-
使用UNUserNotificationCenter
-
那么,它会保持不变吗?
-
UILocalNotification 是 not UNUserNotification。 userNotificationCenter(_:didReceive:withCompletionHandler:) 应该适用于其文档中提到的 iOS 10 (iOS 10.0+)。
-
@dahiya_boy 它有帮助。感谢您节省了我的时间。
标签: ios swift push-notification delegates uilocalnotification