Definir repeatInterval na notificação local
Eu quero definir o intervalo de repetição para o valor que o usuário seleciona a partir do selecionador de data.Eu tenho selecionador de data do tipo modo de contagem regressiva no meu aplicativo.Se o usuário seleciona 4 horas e 15 minutos do selecionador de data, em seguida, estou definindo firedate usando o seguinte código e anéis de alarme .
[NSDate dateWithTimeIntervalSinceNow:[pickerTimer countDownDuration]]
Mas eu quero que a notificação repita a cada 4 horas e 15 minutos até que o usuário a cancele. Eu fiz o r & d pesquisado muito, mas eu não consigo descobrir.O código que tenho usado até agora é:
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
Por favor me ajude a resolver. Muito obrigado antecipadamente.