2
EKReminder *reminder = [EKReminder reminderWithEventStore:self.eventStore];
reminder.title = @"E-Cold 1mg";
reminder.calendar = [_eventStore defaultCalendarForNewReminders];
NSDate *date = [_myDatePicker date];
// get today date
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; // here we create NSDateFormatter object for change the Format of date..
[dateFormatter setDateFormat:@"YYY-MM-dd"]; //Here we can set th
NSLog(@"%@",[dateFormatter stringFromDate:date]);
EKAlarm *alarm = [EKAlarm alarmWithAbsoluteDate:date];
[reminder addAlarm:alarm];
// EKRecurrenceFrequency頻率;錯誤域= EKCADErrorDomain代碼= 1013 「該操作不能完成(EKCADErrorDomain錯誤1013)。」
NSError *error = nil;
[_eventStore saveReminder:reminder commit:YES error:&error];
if (error)
{
NSLog(@"error = %@", error);
}`
上面的代碼設置爲鬧鈴是好的,但是當我重新模擬器調用此方法顯示了新的提醒了這個錯誤時產生錯誤的默認日曆:
Error Domain=EKCADErrorDomain Code=1013 "The operation couldn’t be completed. (EKCADErrorDomain error 1013.)"
error = Error Domain=EKErrorDomain Code=1 "No calendar has been set." UserInfo=0x7f8fca4eac80 {NSLocalizedDescription=No calendar has been set.}
和再次停止並構建應用程序的工作fine.Why這個錯誤即將首次推出