title: How do I start an NSTimer from my app delegate which calls my method in Viewcontroller.m
body: <p>When my app closes I want it to call a void method in <code>viewController.m</code></p>
  
  <p>I tried this:</p>
  
  <p>I have declared a <code>NSTimer</code>(alarmm) and the <code>void(alarm:)</code> in <code>viewController.h</code> and I have imported <code>viewController.h</code> in <code>Appdelegate.m</code></p>
  
  <pre><code>AppDelegate.m:
  
  - (void)applicationDidEnterBackground:(UIApplication *)application{
  
      alarmm = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(alarm:) userInfo:nil repeats:YES];
  
  }
  </code></pre>
  
  <p>but when it runs this comes</p>
  
  <pre><code>**2014-12-20 13:53:19.881 protect my phone[3292:959295] -[AppDelegate alarm:]: unrecognized selector sent to instance 0x170043810
  2014-12-20 13:53:19.884 protect my phone[3292:959295] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate alarm:]: unrecognized selector sent to instance 0x170043810'
  *** First throw call stack:
  (0x182e5659c 0x1935600e4 0x182e5d664 0x182e5a418 0x182d5eb6c 0x183d2ae18 0x182e0e8d8 0x182e0e588 0x182e0bfd4 0x182d390a4 0x18bee35a4 0x18766e3c0 0x10000a320 0x193bcea08)
  libc++abi.dylib: terminating with uncaught exception of type NSException**
  </code></pre>