Wiederholen Sie die UILocalNotification täglich um 17 Uhr

Wie wiederhole ich UILocalNotification täglich um 17 Uhr? Das Folgende ist mein Code zum Einstellen der benutzerdefinierten Zeit. Aber ich möchte den Benutzer täglich zu benutzerdefinierten oder möglicherweise statischen Zeitpunkt benachrichtigen. Ich benutze iOS 6.

    -(void)scheduleNotification{

 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
 [dateFormatter setDateFormat:@"h:mm a"];
NSDate *dateFromString = [[NSDate alloc] init];

dateFromString = [dateFormatter dateFromString:timeStr];

UILocalNotification *localNotif = [[UILocalNotification alloc] init];

if (localNotif == nil)
    return;


localNotif.fireDate = dateFromString;

localNotif.repeatInterval = kCFCalendarUnitDay;
localNotif.timeZone = [NSTimeZone defaultTimeZone];

// Notification details
localNotif.alertBody = @"Reminder is set";
// Set the action button
localNotif.alertAction = @"Ok";

localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;

// Specify custom data for the notification
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Local Push received while running", @"key", nil];
localNotif.userInfo = infoDict;

// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];

}

Antworten auf die Frage(2)

Ihre Antwort auf die Frage