ios - EKEvent 的 eventIdentifier 和 calendarItemExternalIdentifier 的区别

标签 ios objective-c eventkit ekevent ekeventstore

阅读 Apple 的文档,我仍然对 EKCalenderItem's calendarItemExternalIdentifier 之间的区别感到困惑。和 EKEvent's eventIdentifier ,以及我们应该使用哪一个来识别不同设备上的日历事件。具体来说:

EKCalendarItem calendarItemExternalIdentifier The calendar item’s external identifier as provided by the calendar server. (read-only)

EKEvent eventIdentifier: A unique identifier for the event. (read-only)

iOS6 中添加了 EKCalendarItem calendarItemExternalIdentifier,我原以为这将是我需要保存以便稍后在 EKEventStore eventWithIdenfier: 中调用的标识符,因为它声称:

This identifier allows you to access the same event or reminder across multiple devices.

但在我自己的测试中,似乎当我创建并保存一个新的 EKEvent 时,我从 EKEvent 对象获得的 eventIdenifier 是唯一且有用的,而我获得的 calendarItemExternalIdentifier 似乎不适用于 EKEventStore事件标识符:

如果有人有结论性的答案,我很想知道。

最佳答案

calendarItemExternalIdentifier 是事件的 RFC 5545全局唯一标识符。它不特定于 EKEventStore,实际上它表示跨设备(以及非 iOS 客户端)的事件。如果您要从收件箱中打开 .ics 附件,该值将显示在邀请的 UID 字段中。

也就是说,您不能根据此标识符直接查找 EKEventStore 事件。相反,您需要对事件存储进行谓词搜索并检查每个事件的 calendarItemExternalIdentifier

关于ios - EKEvent 的 eventIdentifier 和 calendarItemExternalIdentifier 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23333658/

相关文章:

ios - iOS SDK向iPad上的按钮添加音频?

ios - Touch ID 与 Face ID 代码

ios - 如何使单元格高度适合屏幕

ios - 使用自动布局通过动画更改桌面 View 框架

iphone - 从 EventStore EventKit iOS 获取所有事件

iphone - EventKit EKEvent "organizer"属性的目的/用途是什么?

ios - 输入 radio 不适用于 ios 触摸设备(vue js 应用程序)

ios - 崩溃 network_proxy_decrement_outstanding

ios - 创建一个按钮来滚动 UICollectionView

iphone - 检测并防止旧版 iOS 上的崩溃(怀疑 EventKit)