Local notification executes in the application background based on button title
<p>I am new to iphone.I have a small doubt which is in myproject that is,i have a button in view controller for that button i can change the title when we click on that button here is the code below</p>

<pre><code>- (IBAction)syncOffClickedInRegisterUserScreen:(id)sender {
      if ([syncOnorOff.titleLabel.text isEqualToString:@"Sync off"]) {
        [syncOnorOff setTitle:@"Sync on" forState:UIControlStateNormal];
    } 
    else{
        [syncOnorOff setTitle:@"Sync off" forState:UIControlStateNormal];
    }
 }
</code></pre>

<p>here is code below for the appdelegate having application did enter background delegate method</p>

<pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application {
    NSTimeInterval interval = 1;
    NSDate *alertTime = [NSDate dateWithTimeIntervalSinceNow:interval];
    UIApplication *app = [UIApplication sharedApplication];
    UILocalNotification *notifyAlarm = [[UILocalNotification alloc]init];
    if(notifyAlarm){
        notifyAlarm.fireDate = alertTime;
        notifyAlarm.alertBody = @"Sync Events";
        notifyAlarm.alertAction = @"Sync";
        notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
        [app scheduleLocalNotification:notifyAlarm];
    }
    }
</code></pre>

<p>my task is to when we have a Sync off title in button and application did enter background we have to execute this local notification.If suppose we have a Sync on title in button and application did enter background we can't execute this local notification.How it is possible if anybody knows please help me....</p>
