swift - calendarItemsWithExternalIdentifier 的问题不认为它可以访问实体类型

标签 swift macos

我正在尝试使用外部日历 ID 检索日历条目。我正在使用 xCode 7.1 为目标设置为 10.11 的 mac 应用程序执行此操作,代码为 Swift 2。

当我调用下面的代码时

let myItems = myEventStore.calendarItemsWithExternalIdentifier(searchString)

我在调试输出中得到以下信息

2015-11-04 12:40:03.504 EvesCRM[1447:132129] ERROR: Request access to specific EventKit entity types before attempting to retrieve EventKit objects. 2015-11-04 12:40:03.504 EvesCRM[1447:132129] ERROR: Request access to specific EventKit entity types before attempting to retrieve EventKit objects.

我已检查事件存储是否已授权 Event 和 Reminder 事件类型,并在调用命令之前立即执行了此检查,并且它们已连接并报告已授予访问权限。对同一个事件存储的所有其他调用都按预期工作,似乎只是这个特定函数没有检测到实体类型。

过去一天我一直在寻找解决方案,但找不到任何可以帮助我解决这个问题的方法。希望有人能指出正确的方向来解决这个问题。

最佳答案

我遇到了同样的问题,并通过始终调用 requestAccessToEntityType:completion: 而不是仅使用 authorizationStatusForEntityType: 检查状态来解决它

关于swift - calendarItemsWithExternalIdentifier 的问题不认为它可以访问实体类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33513955/

相关文章:

swift - 我的 Xcode 无法识别结构变量

ios - 导航项中带有搜索栏的连续 View Controller 在动画推送和弹出时会导致 View 模糊

swift - 简单的平方根循环

ruby-on-rails - 警告 : Insecure world writable dir/usr/local/bin in PATH, 模式 040777

mysql - 绑定(bind)的C mysql准备语句问题

在 C (OSX) 中更改文件描述符限制

swift : Changin content of an image from another Container

ios - Uicollectionview 单元格宽度问题 iOS 10

swift - 如何避免强制打开日期 .second 组件?

windows - Mac .Pkg 文件在 Windows 中打开...奇怪的事情