アプリには 2 つUIDatePickers
あり、1 つのモードは日付を選択するためのもので、もう 1 つは時間モードを選択するためのものです。正確な日時になったときに通知を送信しました。正確な時刻にリマインダーを起動できますが、問題は日付がチェックされていないことです。日付と時刻を同時に確認する方法はありますか??
事前にサンクス...
編集
NSDate *date1 = [datePicker date];
NSDate *date2 = [timePicker date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
unsigned unitFlagsDate = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
NSDateComponents *dateComponents = [gregorian components:unitFlagsDate fromDate:date1];
unsigned unitFlagsTime = NSHourCalendarUnit | NSMinuteCalendarUnit ;
NSDateComponents *timeComponents = [gregorian components:unitFlagsTime fromDate:date2];
[dateComponents setHour:[timeComponents hour]];
[dateComponents setMinute:[timeComponents minute]];
NSDate *combDate = [gregorian dateFromComponents:dateComponents];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil) return;
NSDate *fireTime = combDate;
localNotif.fireDate = fireTime;
localNotif.alertBody = @"Alert!";
localNotif.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];