0
의 일정을 삭제에 내가 성공적으로 calendar.I에서 이벤트를 코딩 및 작성하여 달력을 만들었습니다 코딩하여 달력을 삭제할 수 있어요하지만 난 아이폰의 일정을 선택하고 삭제하면 새로이 시간이 작동하지 삭제 달력을 만들었습니다. 를 제안하십시오.문제 아이폰
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKCalendar *calendar = [EKCalendar calendarWithEventStore:eventStore];
calendar.title = CALENDAR_TITLE;
// Iterate over all sources in the event store and look for the local source
EKSource *theSource = nil;
for (EKSource *source in eventStore.sources) {
if (source.sourceType == EKSourceTypeLocal) {
theSource = source;
break;
}
}
if (theSource) {
calendar.source = theSource;
} else {
NSLog(@"Error: Local source not available");
return;
}
NSError *error = nil;
BOOL result = [eventStore saveCalendar:calendar commit:YES error:&error];
if (result) {
NSLog(@"Saved calendar to event store.")
self.calendarIdentifier = calendar.calendarIdentifier;
} else {
NSLog(@"Error saving calendar: %@.", error);
}
// Delete Calendar
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKCalendar *calendar = [eventStore calendarWithIdentifier:self.calendarIdentifier];
if (calendar) {
NSError *error = nil;
BOOL result = [self.eventStore removeCalendar:calendar commit:YES error:&error];
if (result) {
NSLog(@"Deleted calendar from event store.");
} else {
NSLog(@"Deleting calendar failed: %@.", error);
}
}