阅读 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/