I’d be grateful if the Code is updated to Latest Swift syntaxes. The Selfie-Starter code is producing around 17 issues when tried to Build. I’m new to Swift. Otherwise, I’d have tried debugging it myself.
The token is not stored in NSUserDefaults. It’s only checking for a boolean flag if user is logged in or not. User defaults is meant for such things to store non-senstive user preferences or flags. Storing this in Keychain will be bit of a overkill as there is nothing senstive about whether is a user is logged or not.
Having said that you should never store any sensitive information in NSUserDefaults.
Please run it through Ray and request him for an update tutorial. I left the tutorial team sometime last year so won’t have time to look into this. However, if you run into any major issues feel free to ping me.
@subhransu Why are you using http basic auth for the sign in and sign up requests? Are you concerned about hackers hitting those API endpoints and creating accounts? I’m guessing that if were doing FB authentication, then you wouldn’t need that level of security, as you’d be passing a new FB auth token for the server to verify. I can see some reason to use http auth for non-FB authentication so that a robot program couldn’t create fake accounts.
Xcode with Swift 3 updates. Pretty much went to debugger and hit return, since recommendations preventing build were all literal syntax, instead of context
@subhransu I see that your code checks for the token expiry date and then forces the user to log in again if this has expired. Could you explain a little about how one would keep a token valid? A scenario would be to always ensure that the session never expires - as happens on many apps such as Facebook, where once you’ve logged in, you stay logged in, even if you don’t use the app for a very long time.
Is this something the app needs to do in the background every so often? What happens if the user kills the app completely (though doesn’t actually remove it)?
This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]