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 frequency;
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.}
并再次停止并构建应用程序正常工作。为什么第一次启动时出现此错误
答案 0 :(得分:1)
try {
syncUrl = new URL("http://192.168.137.137:4984/test");
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
boolean isSecure = false;
boolean httpOnly = false;
Replication pullReplication = database.createPullReplication(syncUrl);
pullReplication.setContinuous(true);
pullReplication.setCookie("SyncGatewaySession",
"6e2b5106712c0aa3e0048c5b724b302df63d5fbf",
null, 4125798350463L, isSecure, httpOnly);
Replication pushReplication = database.createPushReplication(syncUrl);
pushReplication.setContinuous(true);
pushReplication.setCookie("SyncGatewaySession",
"6e2b5106712c0aa3e0048c5b724b302df63d5fbf",
null, 4125798350463L, isSecure, httpOnly);
pullReplication.start();
pushReplication.start();
pullReplication.addChangeListener(this);
pushReplication.addChangeListener(this);
或可能有以下问题 快速修复: