-3

I'm building an iPhone App which requires to be logged in all the time. Now I don't know if there is a global place to put in something like:

If not_logged_in -> go to LoginView

Bhavin
  • 27,155
  • 11
  • 55
  • 94
Andre Zimpel
  • 2,323
  • 4
  • 27
  • 42

1 Answers1

1

You can write this if-else statement in - applicationDidFinishLaunchingWithOptions:.

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LoggedIn"])
{
    // User already Logged In.
}
else
{
    // Go to Login View.
}

In your loginViewController, after Successful Login add this line :

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"LoggedIn"];
Bhavin
  • 27,155
  • 11
  • 55
  • 94