【发布时间】:2020-12-18 00:01:40
【问题描述】:
我已为 Firebase 通知注册了该应用,并且我已经实现了 UNUserNotificationCenterDelegate。 didReceive 方法在应用程序运行时或在后台调用。
当我终止应用程序并发送通知时。调用了 willFinishLaunchingWithOptions 和 didFinishLaunchingWithOptions 方法,但 launchOptions 对象为 nil 且不包含任何 .remoteNotificaiton 键。
if launchOptions != nil {
logger.log("There is stuff in launch options")
}
我的 AppDelegate 设置
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
@available(iOS 10, *)
extension AppDelegate: UNUserNotificationCenterDelegate
extension AppDelegate: MessagingDelegate
上面的代码从不向控制台打印任何日志消息。
我已经尝试了所有的方法并用谷歌搜索,但没有具体的。
我使用的是 iOS 14 beta 6 和 Xcode beta 6。
提前致谢。
【问题讨论】:
-
它不应该在那里。你会显示代码如何/在哪里设置委托? (顺便说一句,这个工作流程应该在设备上测试 - 它不适用于模拟器)。
-
是的,我在真机而不是模拟器上测试。
-
@Asperi here is my AppDelegate 用我的 AppDelegate 设置更新了问题
标签: swiftui firebase-cloud-messaging ios14