我正在使用EKEventEditViewController
允许将事件从我的应用程序添加到 iPhone 日历。这是目前我正在使用的代码:
[self.store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
if (!granted) { return; }
EKEvent *storedEvent = [EKEvent eventWithEventStore:self.store];
storedEvent.title = self.selectedEvent.title;
storedEvent.startDate = self.selectedEvent.date;
storedEvent.endDate = [NSDate dateWithTimeInterval:60*60 sinceDate:self.selectedEvent.date];
storedEvent.notes = self.selectedEvent.comments;
[storedEvent setCalendar:[self.store defaultCalendarForNewEvents]];
self.eventController.event = storedEvent;
self.eventController.eventStore = self.store;
self.eventController.editViewDelegate = self;
[self presentViewController:self.eventController animated:YES completion:nil];
}];
尽管我已经预先初始化了视图控制器和EventStore
. 有没有办法让它更快,或者我只需要设置一个微调器并告诉用户等待?