Ich möchte UILocalNotificaion für 30 aufeinanderfolgende Tage um 8:00 Uhr täglich planen, und ich möchte diese Funktionalität mit nur einer UILocationNotification-Instanz implementieren. Hier ist mein Code zum Planen der lokalen Benachrichtigung.Wie UILocalNotification für 30 aufeinanderfolgende Tage festgelegt wird
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"HH:mm"];
NSDate *date = [[NSDate alloc] init];
date = [formatter dateFromString:@"08:00"];
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = date;
localNotification.timeZone=[NSTimeZone defaultTimeZone];
localNotification.alertBody = @"You just received a local notification";
localNotification.alertAction = @"View Details";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[formatter release];
[date release];
Es wird täglich Benachrichtigungen Feuer für immer um 08.00 Uhr, aber ich mag nur für 30 aufeinander folgende Tage mitgeteilt werden. Die einfachste Lösung ist, 30 UILocalNotifications auszulösen, aber ich möchte das mit 1 UILocalNotification-Instanz machen. Wie kann ich das machen? Bitte helfen Sie.
Ihre Lösung wird, wenn der Benutzer überprüft arbeiten oder eine Benachrichtigung. Was aber, wenn der Benutzer keine Benachrichtigung erhält oder überprüft? –
@ShahidIqbal haben eine Antwort auf diese spezifische Frage gefunden? – Ilario
@llario Ich denke, ich muss mit Kareems Antwort gehen. –