2013-04-26 31 views
1

我試圖從我的iPhone(iOS 6.1)獲取日曆標題,但沒有發現裏面。 如何從iOS 6.1獲取日曆標題?請幫幫我。事件在iOS 6.1中添加所有日曆?

感謝Adnvance

我嘗試這樣做:

EKEventStore *store = [[EKEventStore alloc]init]; 
EKEvent *event = [EKEvent eventWithEventStore:store]; 
NSArray *list = [[NSArray alloc]init]; 
list = [[store calendarsForEntityType:EKEntityTypeEvent] copy]; 
// Calendars deprecate in iOs 6.1 
// Retain deprecate, so use "copy" 


NSLog(@"list: %d",[list count]); 

for(EKCalendar *calendar in list) 
{ 
    NSLog(@"list: %@",calendar.title); 
} 

回答

2

希望這有助於....

EKEventStore *store = [[EKEventStore alloc] init]; 
[store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { 
    }]; 
NSArray *arrCalenders = [store calendars];//below iOS 6.o 
NSLog(@"%@", arrCalenders); 
NSArray *arrayCalndars = [store calendarsForEntityType:EKEntityTypeEvent]; // In ios 6.o 
NSLog(@"%@", arrayCalndars); 

這顯示日曆的當前列表...