How to identify EKEvent uniquely with Sync across the devices

旧巷老猫 提交于 2019-11-28 02:25:28

eventIdentifier is not shared between devices - same event will most likely have different eventIdentifier on different devices.

Instead, you need to use the calendarItemExternalIdentifier - this will (generally) be the same on different devices.
One (relatively rare) exception is when an event has been created recently using EventKit, and the event was not yet synced to the server. This causes the calndarItemExternalIdentifier to change at a later time.

Using calendarItemExternalIdentifier you can check if an event was already added by querying to see if there's already a record with the same calendarItemExternalIdentifier in your database. The exception described above needs to be handled separately.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!