Finding events
Finding events
- Subject: Finding events
- From: Gideon King <email@hidden>
- Date: Mon, 27 Jan 2014 10:55:40 +1000
When users save a document, I want to save a reference to an event in the file. Then when they open the document on either the same machine or another one, I want them to have access to the same event.
There appear to be three things that could be saved:
- eventIdentifier
- calendarItemIdentifier
- calendarItemExternalIdentifier
The documentation says that the eventIdentifier can change if an event is edited and a different calendar chosen, so it seems pretty easy to lose track on that one, even though the documentation does also seem to imply that this is a suitable way to find events.
The documentation implies that the calendarItemIdentifier is more stable, but not 100% reliable, and would be different for the same event on a different machine with synced calendars.
The calendarItemExternalIdentifier seems to mostly provide what you need to find an item if it is on a shared calendar. They do list some reasons that may fail too, and also say that the identifier is different between Mac and iOS.
So would the following be a suitable approach to do my best to find an event:
- When saving the event reference, save all three identifiers in the file
- When loading:
1. try to find the event by event identifier
2. if that fails, try to find the event by calendar item identifier
3. if that fails, try to find the event by the calendar item external identifier
4. If the event if found by any of these means, save the latest data just in case one of the other identifiers has changed.
If this is not the right approach, what do I need to do differently?
When the documentation says that external identifiers are different between Mac and iOS, does that mean that there is no way of referencing the same event on a shared calendar that is accessed from both operating systems?
It seems that reminders don’t have the extra level of a reminder identifier like the event identifier - I really don’t understand why you would need both for an event and only one for a reminder. So for reminders, I would assume that just steps 2 and 3 above would suffice.
Any tips on this would be much appreciated. I have seen posts where others have asked similar questions, but have not found anything approaching a definitive answer.
Regards
Gideon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden