无法在tabbarcontroller之前显示登录屏幕

时间:2017-12-10 14:33:13

标签: ios swift xcode

我的应用程序中有多个屏幕的代码。我尝试在用户登录后为应用添加TabBarController,但现在应用程序忽略了登录视图控制器。这是我登录屏幕的代码:

import UIKit
import CoreML
import Vision
import FirebaseAuth

class ViewController: UIViewController {




@IBOutlet weak var emailTextfield: UITextField!
@IBOutlet weak var passwordTextfield: UITextField!


@IBAction func createAccountTapped(_ sender: Any) {

    if let email = emailTextfield.text, let password = passwordTextfield.text {

        Auth.auth().createUser(withEmail: email, password: password, completion: { user, error in

            if let firebaseError = error {
                print(firebaseError.localizedDescription)
                return
            }



            self.presentVisRecogScreen()
        })
    }
}

@IBAction func loginTapped(_ sender: Any) {

    if let email = emailTextfield.text, let password = passwordTextfield.text {

        Auth.auth().signIn(withEmail: email, password: password, completion: {(user, error) in
            if let firebaseError = error {
                print(firebaseError.localizedDescription)
                return
            }
            self.presentVisRecogScreen()
        })
    }
}

func presentVisRecogScreen(){

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let viewController = storyboard.instantiateViewController(withIdentifier :"myTabBar")
    self.present(viewController, animated: true)
}

}

我理解应用程序将显示此屏幕,并且一旦调用presentVisRecogScreen函数,它将显示Tabbed应用程序。我哪里错了?

1 个答案:

答案 0 :(得分:0)

我发现了这个问题,我确信这是一个明显的新手错误。我没有勾选方框说我的登录界面是初始视图控制器。

现在完美运作。