title: Unrecognized selector sent to instance, pushViewController:animated
body: <p>I don't know how to solve this problem: </p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController pushViewController:animated:]: unrecognized selector sent to instance 0x8e5fc70'
  </code></pre>
  
  <p>This problem is connected to screen timeout. After 30 seconds of no activity, my App have to back to the login screen, and if the user come back he have to login again. And this is my code:</p>
  
  <pre><code>AppDelegate.h: 
  
  #import &lt;UIKit/UIKit.h&gt; 
  
  @interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt;
  
  @property (strong, nonatomic) UIWindow *window;
  @end
  
  
  AppDelegate.m:
  -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidTimeout:) name:kApplicationDidTimeoutNotification object:nil];
  
      return YES;
  }
  
  -(void)applicationDidTimeout:(NSNotification *) notif
  {
      NSLog (@"time exceeded!!");
      UIViewController *controller = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:@"mainView"];
  
      [(UINavigationController *)self.window.rootViewController pushViewController:controller animated:YES];
  </code></pre>
  
  <p>As you can see the problem is in the last line of this code. This part of the code which I used has been taken from: 
  <a href="https://stackoverflow.com/questions/8085188/ios-perform-action-after-period-of-inactivity-no-user-interaction">iOS perform action after period of inactivity (no user interaction)</a></p>