当我单击FCM推送通知时,我想运行我的应用程序。 (迅速)

时间:2018-10-19 06:50:17

标签: ios firebase notifications firebase-cloud-messaging swift4

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "showSplashScreen") as? ShowSplashScreen {
        if let window = self.window, let rootViewController = window.rootViewController {
            var currentController = rootViewController
            while let presentedController = currentController.presentedViewController {
                currentController = presentedController
            }
            currentController.present(controller, animated: true, completion: nil)
        }
    } 
}

应用程序运行后,当我单击fcm推送通知时,它会很好地打开。但是,当我在后台退出我的应用程序时,我单击了fcm push通知,它不起作用。似乎应用被杀死了。 单击fcm通知时要运行我的应用程序该怎么办? (当应用未运行时)

0 个答案:

没有答案
相关问题