在我的应用程序中,我必须将事件添加到 Iphone 默认日历。我编写的代码如下
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event1 = [EKEvent eventWithEventStore:eventStore];
event1.notes=descriptionStr;
event1.startDate =edate;
event1.endDate=fdate;
[event1 setTimeZone:[NSTimeZone systemTimeZone]];
[event1 setCalendar:[eventStore defaultCalendarForNewEvents]];
问题出在 Iphone5 上。对于4S及以前的版本,事件正在完美添加。请指导我。谢谢。
最佳答案
根据 EKEventStoreClassRef 的 Apple 文档:
On iOS 5 and later, initialize an event store object with the default init method. On iOS 6 and later, you must request access to an entity type after the event store is initialized with requestAccessToEntityType:completion: for data to return.
它可以在安装了 iOS 6 的 4S 上运行吗?
关于iphone - 事件未添加到 Iphone 5 默认日历中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13375982/