我正在尝试在日历上保存一些事件,但我显然无法获得非零事件。当然,我在库中和文件的包含中都包含了EventKit,并且传递的EventStore不是nil。可能是什么?
谢谢,Fabrizio
这是相关的代码:
myEventStore =[[EKEventStore alloc] init];
self.eventStoreAccessGranted = NO;
[myEventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
self.eventStoreAccessGranted = granted;
if (!granted) {
NSLog(@"User has not granted permission");
} else NSLog(@"User has granted permission");
}];
if (self.eventStoreAccessGranted){
NSLog(@"enter calendar");
EKEvent *evento = [EKEvent eventWithEventStore:myEventStore];
if (evento==nil) return;
....
}