如何向EKEvent添加一些其他字段 [英] How to add some additional fields to EKEvent

查看:124
本文介绍了如何向EKEvent添加一些其他字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一种解决方案可能是:

创建一个新模型EKEventExt并在它们之间添加一对一关系,我不确定它是否可行,因为EKEventExt存储在我的一个sqlite中,而EKEvent存储在事件存储中.

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.

推荐答案

可以将自定义字段附加到日历格式(例如iCal)(例如x-my-field),没有像.customFields这样的EKEvent属性如此说来,不幸的是,不可能将您的自定义数据存储在任何字段中.可以创建自己的iCal文件,然后指定您的自定义字段,但它们很快就会丢失.

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.

我建议您使用数据,将其转换为字符串或标识符,并将其存储在URL或注释"字段中.这样可以确保将您的数据传输到日历中并在任何地方同步.如果您希望用户无法读取您的自定义数据,请使用base64版本的字符串.这就是我的做法,效果很好.

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...

这篇关于如何向EKEvent添加一些其他字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆