0
그래서 내 앱에서는 iCal에 크게 의존하고 있으며 EventStore를 사용하여 이벤트를 추가 할 수 있지만 "defaultCalendarForNewEvents"에만 추가 할 수 있습니다. 앱에서 만든 이벤트에 대해서만 새로운 캘린더를 만들고 싶습니다. MyApp 캘린더는 "집", "직장"등과 같이 iCal 캘린더와 매우 유사하게 동작합니다.EventStore를 사용하여 새로운 iCal 캘린더 유형을 만들 수 있습니까?
방법이 있습니까? 이것을 프로 그램 적으로합니까?
는 지금, 나는 이것을 시도했다 : 달력은 달력 배열에없는 경우
이 내 응용 프로그램 위임에라고EKEventStore *eventStore = [[EKEventStore alloc] init];
NSArray *calendars = [eventStore calendars];
BOOL calendarHasBeenInitialized = NO;
for(NSCalendar *cal in calendars)
{
if([cal.calendarIdentifier isEqualToString:@"Workout Tracker"])
{
calendarHasBeenInitialized = YES;
}
}
if(!calendarHasBeenInitialized)
{
NSString *string = [[NSString alloc] initWithString:@"Workout Tracker"];
NSCalendar *workoutCalendar = (__bridge NSCalendar *)(CFCalendarCreateWithIdentifier(kCFAllocatorSystemDefault, (__bridge CFStringRef)string));
EKCalendar *ekcalendar = (EKCalendar *)workoutCalendar;
NSError *error;
[eventStore saveCalendar:ekcalendar commit:YES error:&error];
}
어디, 나는 그것을 만들려고. 그러나 이것은 작동하지 않습니다.
도움이 될 것입니다.
이렇게하면 새 캘린더가 만들어지는 것 같지만이를 사용하여 만든 일정 캘린더를 내 새 캘린더에 설정하려고했습니다. 그러나 eventStore에 이벤트를 저장하려고 할 때 오류가 발생하므로이 방법은 작동하지 않습니다. – BHendricks