开发者

Store a custom value in a EKEvent (iPhone Calendar)

开发者 https://www.devze.com 2023-01-30 07:00 出处:网络
My app integrates with the device calendar.When a new item is added t开发者_如何转开发o my app we create a calendar entry for this item.If the item is edited we need to update the calendar item.

My app integrates with the device calendar. When a new item is added t开发者_如何转开发o my app we create a calendar entry for this item. If the item is edited we need to update the calendar item.

What I do now is put a GUID in the EKEvent.Notes but obviously this is visible to the user so we add a text "do not delete". We then search the calendar for Notes containing the GUID to find the related item.

What would be ideal is if the EKEvent had a Tag property or if there was some type of hidden field that could take a string value. We could then store our related unique ID in this field and not clutter the user's notes field.

Any suggestions on how to handle this?

Thank you.


What is it exactly what you want to do? The 'eventIdentifier' property is meant to uniquely identify an EKEvent instance. Using the EKEventStore you can look up an existing EKEvent using this identifier. It is no surprise this value is read-only.

I can imagine that you want to differentiate between events that were already in the calendar and events that your app created. My solution would be to keep a local registration of what events you added to the calendar. You could for example store this in a local SQLite database. You can refer to events in the iPhone calendar using the 'eventIdentifier' values.

0

精彩评论

暂无评论...
验证码 换一张
取 消