firebaseで認証をしてからアプリを立ち上げたいのですが、セマフォで非同期処理である認証の完了を待とうとするとデッドロック状態になってしまいます。どうしてなのでしょうか?
swift
1 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 2 FirebaseApp.configure() 3 let defaults = UserDefaults.standard 4 defaults.register(defaults: ["firstlaunch":true]) 5 var a = DispatchSemaphore(value: 0) 6 Auth.auth().signInAnonymously { (user, error) in 7 print("ID:a(user)") 8 print(error) 9 a.signal() 10 } 11 a.wait()
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/19 05:45
2019/08/19 06:42