title: Log Out Controller crashes instead of allowing user to log out
body: <p>I have a self-made <em>"log out controller"</em> for my app, and I would appreciate your help on a problem.</p>
  
  <p>My <em>"log out controller"</em> is included my app, accessed by a simple side swipe from another controller; however, I've placed the <em>"log out"</em> button in a simple <code>UITableViewController</code>. </p>
  
  <p>My problem occurs when I hit the <em>"log out"</em> button, the app crashes, and I'm unsure of quite how to parse the data so that the user is successfully logged out once they hit the button. If anybody could tell me where I'm going wrong it would be lifesaving!</p>
  
  <pre><code>- (IBAction)logOutAction:(id)sender {
  
      NSLog(@"yes");
  
      PDKeychainBindings *bindings = [PDKeychainBindings sharedKeychainBindings];
      [bindings setObject:@"no" forKey:@"loggedIn"];
      [bindings setObject:@"" forKey:@"userID"];
  
      UIWindow *window = [[UIApplication sharedApplication] keyWindow];
      UINavigationController *nav = (UINavigationController*)window.rootViewController;
      UIViewController *login = [nav.viewControllers  objectAtIndex:0];
      UINavigationController *slider = (UINavigationController*)login.presentedViewController;
  
      self.logOutButton.enabled = NO;
      [self.logOutButton setAlpha:0.8];
  
      [self performSelector:@selector(logOutAction:) withObject:nil afterDelay:0.1];
      [self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
      [login dismissViewControllerAnimated:YES completion:^{ 
  
      }];
  }
  
  
  - (IBAction)close:(id)sender {
  
      //UIWindow *window = [[UIApplication sharedApplication] keyWindow];
      //DYNavigationController *nav = (DYNavigationController*)window.rootViewController;
      //UIViewController *login = [nav.viewControllerStack objectAtIndex:0];
      // CustomNavController *slider = (CustomNavController*)login.presentedViewController;
      //[self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
      //[login dismissViewControllerAnimated:YES completion:^{    
      // }];
  
      [self dismissViewControllerAnimated:YES completion:nil];
  }
  </code></pre>