0
Я Запланированный мое местное уведомление огня в 4.00 часов и хочу, чтобы уведомление ежедневно в 4.00 часов, но пожары уведомления до времени в 3.44 вечера, 3:47 вечер и т.д.UILocalNotification Schehduling вопрос
вот код -
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *dateComponents = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:self.datePicker.date];
NSDateComponents *timeComponents = [calendar components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:self.datePicker.date];
[dateComponents setHour:[timeComponents hour]];
[dateComponents setMinute:[timeComponents minute]];
[dateComponents setSecond:0.0];
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = [NSString stringWithFormat:@"How are you feeling?"];
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.fireDate = [calendar dateFromComponents:dateComponents];
localNotification.repeatInterval = kCFCalendarUnitDay;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
Попробуйте установить секунду на 1,0 – cyberlobe