Ustaw opcję repeatInterval w lokalnym powiadomieniu

Chcę ustawić interwał powtarzania na wartość, którą użytkownik wybiera z selektora daty. W aplikacji mam selektor daty trybu odliczania typu. .

 [NSDate dateWithTimeIntervalSinceNow:[pickerTimer countDownDuration]] 

Ale chcę, aby to powiadomienie powtarzało się co 4 godziny 15 minut, aż użytkownik je anuluje. Zrobiłem wiele r & d, ale nie mogę się domyślić. Kod, którego dotychczas używałem, to:

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

Pomóż mi rozwiązać. Z góry dziękuję.

questionAnswers(2)

yourAnswerToTheQuestion