iphone - 事件未添加到 Iphone 5 默认日历中

标签 iphone ios

在我的应用程序中,我必须将事件添加到 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/

相关文章:

iphone - 如何获取FB页面的feed?

ios - 导出到 Delphi XE2 中缺少的 Xcode

ios - 如何在 block 中使用 NSTextView?

ios - UITableViewCell 中的 UIDatePicker 更新 UITableViewCell 文本标签

ios - iphone 键盘 unicode 映射

ios - 是否可以仅针对 iphone5 和 6 发布使用 spritekit 和 swift 开发的游戏

iphone - UIAlertView 判断取消按钮是否被选中的简单方法

ios - 像 Instagram iPhone 应用程序一样向右滑动时导航弹出 View 。我如何实现这一点?

css - iPhone Safari CSS 旋转错误

ios - EXC_BAD_ACCESS : When trying to handle touches event in parent UIVIew