title: How to tell which local notification has been received? Objective - C
body: <p>I have this piece of code which calls a different NSLog statement depending on which local notification has been received:</p>
  
  <pre><code>- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
      if (notification == automaticBackupNotification)
      {
          NSLog(@"Backup notification received.");
      }
      else
      {
          NSLog(@"Did receive notification: %@, set for date:%@ .", notification.alertBody, notification.fireDate);
      }
  }
  </code></pre>
  
  <p>And I use this method to schedule the notification in another class:</p>
  
  <pre><code>- (IBAction)automaticValueChanged {
      NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
      if (automaticSwitch.isOn){
          [defaults setValue:@"1" forKey:@"automatic"];
          //schedule notification
          //Set up the local notification
          appDelegate.automaticBackupNotification = [[UILocalNotification alloc] init];
          if(appDelegate.automaticBackupNotification){
              //Repeat the notification according to frequency
              if ([backupFrequencyLabel.text isEqualToString:@"Daily"]) {
                  appDelegate.automaticBackupNotification.repeatInterval = NSDayCalendarUnit;
              }
              if ([backupFrequencyLabel.text isEqualToString:@"Weekly"]) {
                  appDelegate.automaticBackupNotification.repeatInterval = NSWeekCalendarUnit;
              }
              else {
                  appDelegate.automaticBackupNotification.repeatInterval = NSMonthCalendarUnit;
              }
  
              //Set fire date to alert time
              NSCalendar *calendar = appDelegate.automaticBackupNotification.repeatCalendar;
              if (!calendar) {
                  calendar = [NSCalendar currentCalendar];
              }
  
              NSDateComponents *components = [[NSDateComponents alloc] init];
              components.day = 1;
              //NSDate *nextFireDate = [calendar dateByAddingComponents:components toDate:[NSDate date] options:0];
              //appDelegate.automaticBackupNotification.fireDate = nextFireDate;
              appDelegate.automaticBackupNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:20.0];
  
              //Set time zone to default
              appDelegate.automaticBackupNotification.timeZone = [NSTimeZone defaultTimeZone];
  
              // schedule notification
              UIApplication *app = [UIApplication sharedApplication];
              [app scheduleLocalNotification:appDelegate.automaticBackupNotification];
  
              NSLog(@"Backup Fire Date: %@", appDelegate.automaticBackupNotification.fireDate);
          }
      }
      else {
          [defaults setValue:@"0" forKey:@"automatic"];
          if(appDelegate.automaticBackupNotification){
              [[UIApplication sharedApplication] cancelLocalNotification:appDelegate.automaticBackupNotification];
          }
      }
  
      [defaults synchronize];
  }
  </code></pre>
  
  <p>However, when the application delegate receives the notification it fires the 'else' part of the conditional.  Is there any way I can tell between the different notifications?  Or am I doing something wrong?</p>
  
  <p>Cheers,</p>
  
  <p>Tysin</p>