问题
One solution could be:
Creating a new model EKEventExt
and add a One-to-One relationship between them, I'm not sure whether it's doable, since EKEventExt
is stored in my one sqlite and EKEvent
is stored in eventstore.
回答1:
It would be possible to append custom fields to calendar formats such as iCal (like x-my-field
), there is no EKEvent
property like .customFields
etc. Saying this, unfortunately it's not possible to store your custom data in any fields. It would be possible to create your own iCal file and then specify your custom fields, but they will get lost really quick.
I suggest you use your data, convert it to strings or an identfier and store it in the URL or the Notes field. This ensures, your data will be transferred into the calendar and synced anywhere. If you want the user to be unable to read your custom data, use a base64 version of the string. This is how I'm doing it and it works quite well.
To answer your upcoming question: No, unfortunately it's not possible to make one of those fields read-only...
来源:https://stackoverflow.com/questions/32550287/how-to-add-some-additional-fields-to-ekevent