Getting EKCalendar source / name

I work with iOS calendars, I wonder how I can determine the source of calendars. I mean to find a calendar from Facebook, Google, etc.

I use a calendar type, but it's not detailed enough

if (type == EKCalendarTypeLocal) { typeString = @"local"; } else if (type == EKCalendarTypeCalDAV) { typeString = @"calDAV"; } else if (type == EKCalendarTypeExchange) { typeString = @"exchange"; } else if (type == EKSourceTypeMobileMe) { typeString = @"MobileMe"; } else if (type == EKCalendarTypeSubscription) { typeString = @"subscription"; } else if (type == EKCalendarTypeBirthday) { typeString = @"birthday"; 

To add another date, I use

 for (EKCalendar *thisCalendar in calendars) { EKCalendarType type = thisCalendar.type; EKSource* source = thisCalendar.source; DLog(@"title %@", source.title); DLog(@"Src Id %@ and title %@", source.sourceIdentifier, thisCalendar.title); DLog(@"Id %@", thisCalendar.calendarIdentifier); 

But this is not as descriptive as in any application based on the iOS calendar any idea?

+1
source share
2 answers

EKCalendar objects have a source property of type EKSource . The EKSource object has two relevant properties for you: sourceIdentifier and sourceType . Now sourceType more or less matches the type on EKCalendar , and so you can check the original identifier as a string.

Check out the EKCalendar Class Reference and the EKSource Class Reference for more information.

0
source

You can do it:

 EKCalendar *calendar = ... EKSource *calendarSource = [calendar source]; NSString *title = [calendarSource title]; 
0
source

Source: https://habr.com/ru/post/1266865/


All Articles