iOS firebase: FIRAuthUIDelegate.authUI not being called

后端 未结 2 801
孤城傲影
孤城傲影 2021-01-12 20:58

I am trying to launch google login from AppDelegate.swift and then launch my app\'s main screen upon login success.

I am able to

  1. show the g

2条回答
  •  不要未来只要你来
    2021-01-12 21:34

    It must be a problem of reference.

    class AppDelegate: UIResponder, UIApplicationDelegate, FIRAuthUIDelegate {
        var window: UIWindow?
        let authUI = FIRAuthUI.defaultAuthUI()
    
        func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
            FIRApp.configure()
    
            authUI.delegate = self
            let providers: [FIRAuthProviderUI] = [FIRGoogleAuthUI()]
            authUI.providers = providers
    
           // show google login button
           let authViewController = authUI.authViewController()
           self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
           self.window?.rootViewController = authViewController
           self.window?.makeKeyAndVisible()
           return true
        }
    }
    

    Try this. AppDelegate will hold the reference of authUI and its delegate.

提交回复
热议问题