2015-01-10 3 views
0

기본적으로 내가하려는 앱에 문제가 있습니다.이름이 지정된 구독 캘린더를 앱으로 가져오고 모든 이벤트 표시

목표는 iCal에서 특정 가입 캘린더를 가져 와서 모든 이벤트를 배열에 넣는 것입니다.

Ive가 캘린더에 대한 액세스를 요청할 수있었습니다. 필자는 모든 캘린더를 가져오고 단지 지금은 "큰 달력 '라고 명명 된 특정 달력에 그 범위를 좁힐 싶습니다

NSArray *allCalendars = [self.eventStore calendarsForEntityType:EKEntityTypeEvent]; 
NSMutableArray *localCalendars = [[NSMutableArray alloc] init]; 

for (int i=0; i<allCalendars.count; i++) { 
    EKCalendar *currentCalendar = [allCalendars objectAtIndex:i]; 
    if (currentCalendar.type == EKCalendarTypeSubscription) { 
     NSLog(@"%@", currentCalendar); 

를 사용하여 구독 캘린더를 표시 할 수 있었다. 그 달력에있는 모든 이벤트를 배열에 표시하고 싶습니다.

그 목표를 달성하는 비교적 효율적인 방법이 가능합니까?

코드 작성 방법에 대한 제안 사항이 있으십니까?

덕분에 매우

답변

0

당신은 제목 속성을 사용하여 제목 == @ "큰 달력"다음을 가져 오면 확인할 수 있습니다.

for (int i=0; i<allCalendars.count; i++) { 
    EKCalendar *currentCalendar = [allCalendars objectAtIndex:i]; 
    if (currentCalendar.type == EKCalendarTypeSubscription && currentCalendar.title == @"Big Calendar") { 
     NSLog(@"%@", currentCalendar); 

도움이되기를 바랍니다.

+0

행운이 없다고 생각합니다. 그 이유는 내가 원하는 캘린더에서 allowsModify = NO라고 생각하기 때문입니다. 이 문제를 해결할 방법이 있을까요? – simbo64