Legen Sie repeatInterval in der lokalen Benachrichtigung fest

Ich möchte das Wiederholungsintervall auf den Wert einstellen, den der Benutzer in der Datumsauswahl auswählt. In meiner Anwendung befindet sich eine Datumsauswahl vom Typ Countdown. Wenn der Benutzer 4 Stunden und 15 Minuten in der Datumsauswahl auswählt, stelle ich das Feuersignal mit dem folgenden Code und den Alarmringen ein .

 [NSDate dateWithTimeIntervalSinceNow:[pickerTimer countDownDuration]] 

Ich möchte jedoch, dass die Benachrichtigung alle 4 Stunden und 15 Minuten wiederholt wird, bis der Benutzer sie storniert. Ich habe viel nach F & E gesucht, aber ich kann es nicht herausfinden. Der Code, den ich bisher verwendet habe, ist:

localNotification = [[UILocalNotification alloc] init]; 
[localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:[pickerTimer countDownDuration]]]; 

if(localNotification.fireDate){

    [self _showAlert:@"Time is scheduled" withTitle:@"Daily Achiever"];
}
localNotification.timeZone = [NSTimeZone systemTimeZone];


localNotification.alertBody=@"alaram";
localNotification.soundName = UILocalNotificationDefaultSoundName;
[localNotification setAlertAction:@"View"];
[localNotification setRepeatInterval:[pickerTimer countDownDuration]];

//The button's text that launches the application and is shown in the alert
// [localNotification setAlertBody:[alertBodyField text]]; //Set the message in the notification from the textField's text
//[localNotification setHasAction: YES]; //Set that pushing the button will launch the application
[localNotification setApplicationIconBadgeNumber:[[UIApplication sharedApplication] applicationIconBadgeNumber]]; //Set the Application Icon Badge Number of the application's icon to the current Application Icon Badge Number plus 1

  localNotification.applicationIconBadgeNumber = 1;

localNotification.repeatInterval=NSHourCalendarUnit;

[[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; //Schedule the notification with the system

//[alertNotification setHidden:NO]; //Set the alertNotification to be shown showing the user that the application has registered the local notification

Bitte hilf mir zu lösen. Vielen Dank im Voraus.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage