Получите идентификатор сообщения firebase из функции в swift и передайте в viewcontroller - PullRequest
0 голосов
/ 30 января 2020

У меня есть следующая функция в appdelegate.swift:

      // [START receive_message]
  func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
    // If you are receiving a notification message while your app is in the background,
    // this callback will not be fired till the user taps on the notification launching the application.
    // TODO: Handle data of notification
    // With swizzling disabled you must let Messaging know about the message, for Analytics
    // Messaging.messaging().appDidReceiveMessage(userInfo)
    // Print message ID.
    if let messageID = userInfo[gcmMessageIDKey] {
      print("Message ID: \(messageID)")
    }

    // Print full message.
    print(userInfo)
  }

Мне нужно перейти к моему URL веб-просмотра в viewcontroller, как это:

  let url = URL(string: "https://www.mydomain.ext/index.php?token=\(token ?? "")&messageid=\(messageID)")!

Спасибо!

...