title: Old Local Notifications Firing on iOS
body: <p>I have a set of UILocalNotifications that I am scheduling. They are firing on time and seem to be working fine. However, on occasion, when a <strong>NEW</strong> notification fires there are multiple (sometimes only one) <strong>OLD</strong> notifications that fire along with it.</p>
  
  <p>For example, I schedule a UILocalNotification to take out the trash on Monday at 5pm with no repeat interval. It fires no problem and on time. On Tuesday, I have a UILocalNotification to bring in the trash bins for Tuesday at 5pm, again with no repeat interval. When that one fires, I will see the correct notification for <strong>NOW</strong>, but also below the current notification will be another notification to take the trash out <strong>1 Day Ago</strong>. I have not rescheduled this notification. It appears to be the notification from yesterday. </p>
  
  <p>It is very bizarre and I cannot reproduce it on any sort of consistent basis. I thought that maybe there were some old notifications being added somehow so I added some logic to run through all scheduled notifications and remove any that had a fire date that was in the past but that did not help. Anyone else ever see this problem? Is there some manual clearing of a notification that I need to do when one fires?</p>
  
  <p>EDIT: Added some of the scheduling code</p>
  
  <pre><code>//only schedule if the alert date is later than now
  if ([AMDateUtil isNowEarlierThanDate:alertDate]) {
      //create the notification and setup some properties
      UILocalNotification *localNotification = [[UILocalNotification alloc] init];
      localNotification.fireDate = alertDate;
      localNotification.timeZone = [NSTimeZone defaultTimeZone];
  
      localNotification.alertAction = nil;
      localNotification.soundName = UILocalNotificationDefaultSoundName;
  
      //add the local notification
      [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
  }
  </code></pre>