1
我正在開發具有提醒組件的應用程序。我使用Calendar Store來獲取日曆列表,並且我希望用戶選擇他們想要添加任務的日曆。問題是,CalCalendar似乎沒有區分事件日曆和任務日曆。日曆商店:如何區分事件日曆和任務日曆?
NSArray* calendars = [[CalCalendarStore defaultCalendarStore] calendars];
for(CalCalendar* aCalendar in calendars) {
if(aCalendar.isEditable) {
NSLog(@"editable calendar: %@", aCalendar);
}
}
此輸出:
editable calendar: CalCalendar <0x6e04d10> {UID = 8AA8FFAD-D781-47F7-9231-CF66E1753983; title = Work; notes = (null); color = NSCalibratedRGBColorSpace 0.054902 0.380392 0.72549 1; type = CalDAV; editable = 1}
editable calendar: CalCalendar <0x6e05000> {UID = A7F4A1B2-D1CF-4A20-9F84-CD1A1E99773E; title = Home; notes = ; color = NSCalibratedRGBColorSpace 0.72549 0.054902 0.156863 1; type = CalDAV; editable = 1}
editable calendar: CalCalendar <0x6e050f0> {UID = 43B14D2A-9976-461C-8EFE-5FA029381828; title = Personal; notes = (null); color = NSCalibratedRGBColorSpace 0.901961 0.784314 0 1; type = CalDAV; editable = 1}
editable calendar: CalCalendar <0x6e05140> {UID = F42EC365-20AC-4251-B45E-FB7F169928F0; title = Mac; notes = (null); color = NSCalibratedRGBColorSpace 0.054902 0.380392 0.72549 1; type = Local; editable = 1}
editable calendar: CalCalendar <0x6e05190> {UID = FF771FF9-3969-4001-BBA4-9B7B00E80291; title = Cloud 2; notes = (null); color = NSCalibratedRGBColorSpace 0.054902 0.380392 0.72549 1; type = CalDAV; editable = 1}
editable calendar: CalCalendar <0x6e051e0> {UID = 40234537-869C-4CC2-89B9-DD4F7D36C169; title = Groceries; notes = ; color = NSCalibratedRGBColorSpace 0.443137 0.101961 0.462745 1; type = CalDAV; editable = 1}
我知道第2事件日曆,最後4是任務列表。而且,iCal明確知道其中的差異,因爲它只顯示事件的事件日曆和任務的任務日曆。
但似乎沒有辦法通過Calendar Store API來以編程方式確定這一點,除非我錯過了一些東西。
更新:我看到我不是唯一注意到這一點的人,因爲我發現了rdar://10377730。我剛剛提交了自己的報告,作爲rdar://10980542