2012-07-24 1 views
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); 
    } 
} 

답변

0

나는 경험이있다. iOS 5.0에서는 실제로 캘린더가 자동으로 미리 알림에 사용되는 것처럼 보입니다. 미리 알림 앱에서 캘린더를 삭제해야합니다.

캘린더 앱에서 프로그래밍 방식으로 만든 캘린더를 삭제하려고 시도했지만 실패한 경우에도 알림을받지 못하는 iOS의 버그 일 수 있습니다.