In my new project, I am making sure that users do not have to go to the login screen every time they open the app by using the following code:
// this means that there is a user logged in... take them to the main view.
if let x = FIRAuth.auth()?.currentUser?.uid {
print("The current user is: \(x)")
// first param is storyboard name
self.setTheRootViewController("Main", identifier: "GroupChatsView")
}
// take them to the login view controller
else {
self.setTheRootViewController("Main", identifier: "LoginView")
}
I have not created any users yet, so I would expect this code to take me to the login view every time. But, For some odd reason, when I print out the current user's unique id, it is my own unique id from a previous project. I am not sure what to do at this point. Also, everything in my GoogleService-Info.plist matches up with my new project.
When I logout of my other app in the iOS simulator, the code functions as expected.
Are there any easy workarounds for this? Thanks.
答案 0 :(得分:0)
在模拟器中清理和重置设置!这样做。