簡體   English   中英

Firebase iOS 身份驗證 - 執行 segue

[英]Firebase iOS Authentication - Performing segue

我目前正在向我的 iOS 應用程序添加 Firebase 身份驗證。 我可以注冊並登錄用戶,但是,我很難找到可以添加 segue 以進入下一個屏幕的位置。

func signInUser(email: String, password: String){
    // creates user with the firebase autenthication platform
    Auth.auth().signIn(withEmail: email, password: password) { [weak self] authResult, error in
        guard let strongSelf = self else { return }
    }
    
    // would the segue go here?
}

您應該在signIn function 完成處理程序中執行您的代碼:

func signInUser(email: String, password: String){
    //creates user with the firebase autenthication platform
    Auth.auth().signIn(withEmail: email, password: password) { [weak self] authResult, error in
        guard let strongSelf = self else { return }

        if let error = error as? NSError {
            // Handle sign in error
            switch AuthErrorCode(error.code) {
                ...
            }
        } else {
            // No errors: Perform segue here...
        }
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM