2013-06-19 57 views
1

我正在使用IOS日历,我想知道如何检测日历的来源。我的意思是检测日历是从Facebook,谷歌等获取EKCalendar的源/名称

我使用的日历类型,但是,它不是足够详细

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"; 

只需添加更多的日期,我使用

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内置应用程序 有什么想法?

回答

0

EKCalendar对象有source类型EKSource类型的属性。 EKSource对象有两个相关属性:sourceIdentifiersourceType。现在,sourceTypeEKCalendar上的类型差不多,因此您可能需要检查sourceIdentifier,因为它只是一个字符串。

签出EKCalendar Class ReferenceEKSource Class Reference的详细信息。

0

你可以这样做:

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

是我做的,但只得到这样的Src标识6DFC6A45-2C16-4D4D-B96E-A98D50675706和产权工作 – Agus