FirebaseAuth/Auth.swift
Токен получен, но оказался нулевым.
Код: Выделить всё
import UIKit
import Firebase
import FirebaseAuth
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Auth.auth().setAPNSToken(deviceToken, type: .unknown)
print("APNs Token registered with Firebase Auth.")
}
func application(_ application: UIApplication, didReceiveRemoteNotification notification: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
if Auth.auth().canHandleNotification(notification) {
print("Handled Firebase Auth-related push notification.")
completionHandler(.noData)
return
}
completionHandler(.newData)
}
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if Auth.auth().canHandle(url) {
print("Handled Firebase Auth-related URL redirect.")
return true
}
return false
}
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... pping-an-o
Мобильная версия