我收到一个错误:
删除事件错误:错误Domain = EKErrorDomain Code = 11"该事件不属于该事件存储." UserInfo = 0x1fdf96b0 {NSLocalizedDescription =该事件不属于该事件存储.
当我尝试删除刚创建的EKEvent时.
下面的代码显示我正在存储eventIdentifier并使用它来检索事件.此外,当我这样做,NSLog事件,我可以正确地看到它的所有属性.
从我看到的所有例子中我都正确地做了一切.我也是NSLog'ed EKEventStore的eventStoreIdentifier,每当我在任何一个方法中访问它时它都是一样的,所以它应该是相同的EKEventStore.
任何帮助将不胜感激.
- (EKEvent *) getCurrentCalendarEvent {
NSString *currentCalendarEventID = [[UserModel sharedManager] currentCalendarEventID];
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [eventStore eventWithIdentifier:currentCalendarEventID];
return event;
}
- (void) removeCurrentCalendarEvent {
EKEvent *event = [self getCurrentCalendarEvent];
if (event) {
NSError *error;
EKEventStore *eventStore = [[EKEventStore alloc] init];
[eventStore removeEvent:event span:EKSpanFutureEvents error:&error];
}
}
- (void) addCurrentCalendarEvent {
[self removeCurrentCalendarEvent];
EKEventStore *eventStore = [[EKEventStore alloc] init]; …Run Code Online (Sandbox Code Playgroud)