title: Checking if view controller has been loaded before
body: <p>I am trying to checking if a certain view has been loaded ever before in the lifetime of the app. I have implemented the following code but not quite sure why it isn't working. It is being done in the viewDidLoad method only of the view controller (perhaps this is the problem). If anyone can let me know what my mistake is, it would be appreciated. Thanks!</p>
  
  <pre><code> NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
   BOOL hasRunBefore = [defaults boolForKey:@"FirstRun"];
                       if (hasRunBefore) {
                           NSLog (@"not the very first time this controller has been loaded");
                            [defaults setBool:YES forKey:@"FirstRun"];
                           [defaults synchronize];
                       }
                       else if (!hasRunBefore) {
                           [defaults setBool:NO forKey:@"FirstRun"];
                            NSLog (@"the very first time this controller has been loaded");
                           [defaults synchronize];
                       }
  </code></pre>