我无法使用Eventkit访问设备的日历。我使用一个EKEventEditViewController来显示一个添加日历条目的视图。
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEventEditViewController *eventController = [[EKEventEditViewController alloc]init];
eventController.eventStore = eventStore;
eventController.editViewDelegate = self;
...
[self presentViewController:eventController animated:YES completion:nil];此在模拟器上运行良好,但我在电话(IOS6)上运行它时会收到以下错误消息:“此应用程序无法访问日历”

按建议检查隐私设置不会显示我的应用程序的任何条目。
如何解决这一问题并授予访问权?
发布于 2012-11-08 22:17:15
您可以请求访问
EKEventStore *store = [[EKEventStore alloc] init];
if([store respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
[store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
/* This code will run when uses has made his/her choice */
}];
}您还可以向plist (NSCalendarsUsageDescription)添加一个键,该键将在请求所述访问时显示字符串。
https://stackoverflow.com/questions/13298590
复制相似问题