-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset UI if the login fails. #9
Comments
Even to one new to coding, this issue was pretty simple to fix. I simply added 'setLoggingIn(false)' after both the if and else blocks within the handleLoginResponse method. This should terminate the activity indicator and re-enable the locked fields and buttons in the LoginViewController. |
setLoggingIn(false) in handle login response inside else block helped me to enable buttons again to try another username and password to get login information correct |
I think calling |
My solution: |
did the same thing @EdwardPhaniOS. I also added that to the loginViaWebsiteTapped method if the getRequestToken response was successful because the logginIn method was hanging after going to the browser and coming back again. @IBAction func loginViaWebsiteTapped() { |
In lesson 7, we added an activity indicator to the login view. The view appears and starts spinning when the login process begins, and stops spinning and disappears when the login is complete.
But what happens if the login doesn't complete? Try an incorrect username/password or modifying the API key. After dismissing the alert, the spinner keeps spinning. You'll also notice that the text fields can't be edited, nor can you press any of the buttons.
We already know where to add code for when the login fails. To fix this issue, try calling
setLoggingIn()
in the appropriate places to ensure UI changes appropriately to match the "logging in" state.The text was updated successfully, but these errors were encountered: