从 iPhone 应用程序添加到 iCal 时发生“事件没有日历设置”错误?
我是 iPhone 应用程序开发新手。现在,我正在努力从 iPhone 应用程序向 iCal 添加事件。问题是在向 iCal 添加超过 70 个事件(重复事件)时,这些事件尚未添加到 iCal 中。 iCal 通过错误消息是 ["Error Domain=EKErrorDomain Code=1 "The event has no calendar set." UserInfo=0xfada510 {NSLocalizedDescription=The event has no calendar set.}”]. 如何解决这个问题?请指导我解决这个问题?谢谢,
这是我的代码...
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *events = [EKEvent eventWithEventStore:eventStore];
events.title = @"Title";
events.notes = @"Descriptions";
events.location = @"Location";
events.startDate = DATE;
events.endDate = endDates;
events.availability = EKEventAvailabilityFree;
[events setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:events span:EKSpanThisEvent error:&err];
NSLog(@"Error From iCal : %@", [err description]);
NSString *eventID = [[NSString alloc] initWithFormat:@"%@", events.eventIdentifier];
NSLog(@"EventID : %@", eventID);
有时 eventID 返回 null 并且 [err description] 显示错误 [“Error Domain=EKErrorDomain” Code=1“该事件没有设置日历。” UserInfo=0xfada510 {NSLocalizedDescription=该活动没有设置日历。}”]。如何解决这个问题?有什么想法吗?感谢您与我一起度过了宝贵的时间...
Am new to iPhone App development. Now, am struggling with adding event to iCal from iPhone application. The problem is While adding More than 70 events(Repeated events) to iCal the events has not add in iCal. The iCal through the Error message is ["Error Domain=EKErrorDomain Code=1 "The event has no calendar set." UserInfo=0xfada510 {NSLocalizedDescription=The event has no calendar set.}”]. How to solve this problem? Can you please guide me to solve this problem? Where i'm doing wrong? Thanks is advance.
This is my code...
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *events = [EKEvent eventWithEventStore:eventStore];
events.title = @"Title";
events.notes = @"Descriptions";
events.location = @"Location";
events.startDate = DATE;
events.endDate = endDates;
events.availability = EKEventAvailabilityFree;
[events setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:events span:EKSpanThisEvent error:&err];
NSLog(@"Error From iCal : %@", [err description]);
NSString *eventID = [[NSString alloc] initWithFormat:@"%@", events.eventIdentifier];
NSLog(@"EventID : %@", eventID);
Sometimes the eventID is return null and The [err description] shows the Error ["Error Domain=EKErrorDomain Code=1 "The event has no calendar set." UserInfo=0xfada510 {NSLocalizedDescription=The event has no calendar set.}”]. How to solve this ? Any ideas? Thanks for spending your valuable time with me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不知道您是否同时解决了这个问题,但如果没有,您似乎需要首先找到并分配一个日历,如下所示:
Don't know if you've solved this problem in the meantime but if not, it looks like you need to find and assign a calendar first such as below: