2013-06-19 54 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