title: iOS How to cancel a scheduled localnotification
body: <p>I am writing an iPhone app in which I have three countdown timers, that each set a local notification when they are started by the user (IBAction).</p>
  
  <p>My question is, how can I reference to an existing local notification elsewhere in the code? I have tried referencing it directly like this which crashes:</p>
  
  <pre><code>[[UIApplication sharedApplication] cancelLocalNotification:myNotification];
  </code></pre>
  
  <p>And like this after scheduling the notification and adding it to the user defaults:</p>
  
  <pre><code>In my scheduling method...
  [myDefaults setObject:myNotification forKey:@"myNotification"];
  ...
  
  And in my cancelling method...
  NSUserDefaults *myDefaults = [NSUserDefaults standardUserDefaults];
  [[UIApplication sharedApplication] cancelLocalNotification:[myDefaults objectForKey:@"myNotification"]];
  [myDefaults synchronize];
  </code></pre>
  
  <p>My app crashes with a SIGABRT error on the cancelLocalNotification line above. Can anybody tell me where I am going wrong?</p>
  
  <p>Thanks in advance!</p>