How do I bypass the welcome screen UI and present only the phone auth UI screen in Firebase Auth?

笑着哭i 提交于 2020-01-06 09:04:00

问题


How can I present the viewController which is responsible for collecting phone number data in FirebaseUI rather than the welcome screen?

With the current set up I am presented with a Welcome screen.

   class Login: UIViewController, FUIAuthDelegate {
    let authUI = FUIAuth.defaultAuthUI()

     override func viewDidAppear(_ animated: Bool) {


    let phoneProvider = FUIPhoneAuth(authUI: authUI!)
    authUI!.isSignInWithEmailHidden = true
    authUI!.providers = [phoneProvider]
    let vc = authUI?.authViewController()

    self.present(vc!, animated: true, completion: nil)
     }
 }

EDIT Thanks to proxpero I can present the phone UI like this:

class Login: UIViewController, FUIAuthDelegate {
    let authUI = FUIAuth.defaultAuthUI()

   override func viewDidAppear(_ animated: Bool) {

    authUI?.delegate = self
    let phoneProvider = FUIPhoneAuth(authUI: authUI!)
    authUI!.isSignInWithEmailHidden = true
    authUI!.providers = [phoneProvider]
    phoneProvider.signIn(withPresenting: self, phoneNumber: nil)
     }
 }


回答1:


If you want to bypass the welcome screen, and present the phone auth screen straightaway, I think that instead of self.present(vc!, animated: true, completion: nil), put phoneProvider.signIn(withPresenting: self, phoneNumber: nil).

This method on phoneProvider creates the phone auth ui view controller and presents it on the parent view controller that you pass in (self in this case).



来源:https://stackoverflow.com/questions/52821746/how-do-i-bypass-the-welcome-screen-ui-and-present-only-the-phone-auth-ui-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!