1

I tried to get calendar title from my iPhone (iOS 6.1), but nothing found inside. How to get calendar title from iOS 6.1? please help me.

Thanks in Adnvance

I tried this:

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);
}
4

1 回答 1

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

这将显示当前日历列表...

于 2013-04-26T09:18:17.560 回答