将自定义值存储在 EKEvent(iPhone 日历)中

发布于 2024-10-07 12:39:29 字数 302 浏览 0 评论 0原文

我的应用程序与设备日历集成。当新项目添加到我的应用程序时,我们会为此项目创建一个日历条目。如果项目被编辑,我们需要更新日历项目。

我现在所做的是将 GUID 放入 EKEvent.Notes 中,但显然这对用户是可见的,因此我们添加文本“请勿删除”。然后,我们在日历中搜索包含 GUID 的便笺以查找相关项目。

理想的情况是 EKEvent 具有 Tag 属性,或者存在某种类型的隐藏字段可以采用字符串值。然后,我们可以将相关的唯一 ID 存储在该字段中,而不会弄乱用户的注释字段。

关于如何处理这个问题有什么建议吗?

谢谢。

My app integrates with the device calendar. When a new item is added to 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨曦÷微暖 2024-10-14 12:39:29

你到底想做什么? “eventIdentifier”属性旨在唯一标识 EKEvent 实例。使用 EKEventStore,您可以使用此标识符查找现有的 EKEvent。毫不奇怪,该值是只读的。

我可以想象您希望区分日历中已有的事件和您的应用程序创建的事件。我的解决方案是保留您添加到日历中的事件的本地注册。例如,您可以将其存储在本地 SQLite 数据库中。您可以使用“eventIdentifier”值引用 iPhone 日历中的事件。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文