我正在尝试使用外部日历 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/