title: ios local notification check before fire
body: <p>I am trying to run some function every n-minutes when app is not running. 
  I thing local notification is suitable for that, but I have one problem.</p>
  
  <p>If I set local notification as :</p>
  
  <pre><code> -(void)notification{
       UILocalNotification *localNotif = [[UILocalNotification alloc] init];
       if (localNotif == nil)
           return;
       localNotif.fireDate = [[NSDate date] dateByAddingTimeInterval:15];
       //localNotif.timeZone = [NSTimeZone defaultTimeZone];
  
   // Notification details
       localNotif.alertBody = @"marko";
   // Set the action button
       localNotif.alertAction = @"View";
  
       localNotif.soundName = UILocalNotificationDefaultSoundName;
       localNotif.applicationIconBadgeNumber = 1;
  
   // Specify custom data for the notification
       NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"someValue" forKey:@"someKey"];
       localNotif.userInfo = infoDict;
  
  // Schedule the notification
     [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
  }
  </code></pre>
  
  <p>The notification is fired every time and then do:</p>
  
  <pre><code> - (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
  NSLog(@"Recieved Notification %@",notif);
   }
  </code></pre>
  
  <p>What I would want is to after 15s first fire some function and if function return YES then play sound and put badge on it.</p>
  
  <p>How to do that?</p>