1
저는 EventKit 프레임 워크를 사용하여 기기에 동기화 된 캘린더를 가져오고 EKCalendar
오브젝트의 캘린더 제목 [email protected]
을 얻는 것이 좋습니다! 그러나 우리는이 계정의 서비스 공급자가 누구인지 알아야합니다. ww는 접미사가 "@ gmail.com"이므로 Google 계정임을 알고 있으므로 "@ mycoolsite.com"이 포함 된 Google 계정이 될 수도 있습니다. 여기서 우리는 무엇을합니까? 실제로 시스템에서 서비스 공급자를 얻으려면 어떻게해야합니까?EKEventStore에서 캘린더 제공 업체 (Google, Apple, Yahoo 등)를 얻는 방법
EKEventStore * eventStore = [[EKEventStore alloc] init];
NSMutableArray*calendars = [[NSMutableArray alloc]init];
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
if (granted)
{
dispatch_async(dispatch_get_main_queue(), ^{
NSArray * accountsArray = [eventStore calendarsForEntityType:EKEntityTypeEvent];// ios 6^
for (int i = 0; i < [accountsArray count]; i++) {
NSString *cal = [[accountsArray objectAtIndex:i] valueForKey:@"title"];
if ([cal rangeOfString:@"@"].location != NSNotFound) {
[calendars addObject:[[accountsArray objectAtIndex:i] valueForKey:@"title"]];
}
}
[self gotCalendars:calendars];
});
}