我试图从我的iPhone(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);
}
答案 0 :(得分: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);
这会显示当前的日历列表......