0

We have a navigation controller as our rootcontroller, which then goes to a viewcontroller with a spinner on it. That controller handles the call to see if the user is logged in or not. It is connected to two different controllers. If they are already logged in, it goes to the mainViewController. If they haven't logged in, it goes to the loginViewController. The loginViewController will loop around to the mainViewController on success.

I am trying to implement this method to my app. My app only allows user to login through social network. In this case, let's say Facebook. How can I check if the user has logged in before or not?

Thanks!

Anindya Sengupta
  • 2,539
  • 2
  • 21
  • 27
Justin Chan
  • 105
  • 3
  • Take a look on this: http://stackoverflow.com/questions/19962276/best-practices-for-storyboard-login-screen-handling-clearing-of-data-upon-logou/21877460#21877460 – Dimitris Bouzikas Mar 20 '14 at 23:20

1 Answers1

0

Facebook Developer page says:

Check if the user session is valid. You may do this to check if an access_token is valid so you can handle re-authenticating the user. You may also do this to expose functionality that requires the user to be logged in.

So, that is exactly what you should be doing. Check if the session is valid, if not present the login screen.

For other APIs also, there would be some kind of session information available through web service call or something which will enable you to know whether the user is logged in or not.

Anindya Sengupta
  • 2,539
  • 2
  • 21
  • 27