不允许我从应用程序委托文件中选择另一个视图控制器
我已经尝试过呈现ViewController
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if let authentication = user.authentication {
let credential = GoogleAuthProvider.credential(withIDToken: authentication.idToken, accessToken: authentication.accessToken)
Auth.auth().signInAndRetrieveData(with: credential) { (authResult, error) in
if error != nil {
print(error!)
} else{
print("user successfully signed in through GOOGLE! uid:\(Auth.auth().currentUser!.uid)")
print("signed in through AppDelegate")
performSegue(withIdentifier: "goToUsers", sender: self)
print("Done Segue")
}
}
}
}
答案 0 :(得分:0)
您无法从AppDelegate执行segue。
您应该执行以下操作,而不是performSegue:
let activityStoryboard = UIStoryboard(name: "Main", bundle: nil)
let vc = activityStoryboard.instantiateViewController(withIdentifier: "main-activity")
window?.rootViewController = vc
window?.makeKeyAndVisible()
将“主要活动”替换为在情节提要中设置后要访问的视图控制器的标识符。