获取EKCalendar的来源/名称
我正在使用IOS日历,我想知道如何检测日历的来源。 我的意思是检测日历是从Facebook,谷歌等
我正在使用日历types,但它不够详细
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";
只是为了添加更多的date,我正在使用
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);
但是这并不是真正的描述性的,因为日历上的iOS内置应用程序有什么想法?
EKCalendar
对象具有EKCalendar
types的source
属性。 一个EKSource
对象有两个相关的属性: sourceIdentifier
和sourceType
。 现在, sourceType
与EKCalendar
上的typesEKCalendar
,因此您可能需要检查sourceIdentifier,因为它只是一个string。
详细信息请查看EKCalendar类参考和EKSource类参考 。
你可以这样做:
EKCalendar *calendar = ... EKSource *calendarSource = [calendar source]; NSString *title = [calendarSource title];