ical iPhone 中的只读项目
我需要从本地应用程序或可能是远程服务器在 iPhone 日历上显示一些事件。我需要 iphone 日历中显示的事件是只读的,并且正在尝试找出最佳方法。有几个问题可以帮助我解决这个问题
- 从 ios iphone 应用程序中,我可以将日历事件写为只读吗? - 如果我需要从服务器转到手机,我可以为手机提供一个只读日历的 URL 吗?这将禁止更新手机上的项目? -如果我将日历中的事件消耗到 iPhone 应用程序中,我可以知道该项目的来源是什么吗?这意味着我可以区分用户在本地制作的内容、交换、gmail 等和icalendar 只读提要吗
谢谢
I need to display some events on the iphone calendar from either a local app or possibly a remote server. I need the events shown in the iphone calendar to be readonly and am trying to figure out the best approach for this. Couple of questions to help me with the approach
-From ios iphone app can I write calendar events as readonly?
-If I need to go from the server to the phone can I give the phone a url to a icalendar that is readonly? which will disallow updates to the item on the phone?
-If I consume the events from the icalendar in to an iphone application can I tell what the origin of the item is? meaning can I tell the difference between things the user made locally, exchange, gmail etc.. and the icalendar readonly feed
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕您无法在用户日历中创建只读日历条目。毕竟,这是用户日历,而不是您的应用程序。
您也不能为您的应用程序创建可以从 URL 读取的单独日历。您可以向用户提供 URL 并要求他们手动将其添加到 iCal,但您无法通过 EventKit 框架执行此操作。
您无法判断事件的来源,因为
EKEvent
没有任何类型的公共属性来提供此信息。您可以通过迭代可用日历并查看其标题来推断哪个是只读日历。但是,这仅适用于用户实际手动添加日历的假设,并且他们没有更改标题。
使用您想要的所有功能执行此类操作的最佳方法是将应用程序内日历功能添加到您的应用程序中,并使其完全独立于 iCal 和 EventKit。
这里有几个项目可以帮助...
I'm afraid you cannot create a read-only calendar entry in a users calendar. After all, it's the users calendar, not your apps.
Nor can you create a separate calendar specific for your app that can read from a URL. You could provide the URL to the user and ask them to add it to iCal manually, but you cannot do it via the EventKit Framework.
You can't tell the origin of an event as
EKEvent
doesn't have any sort of public property that provides this information.You would be able to infer which was the read-only calendar by iterating over the available calenders and looking at their titles. However, this would only work on the assumptions the user actually added your calendar manually, and they didn't change the title.
The best way to do something like this with all the features you want would be to add in-app calendar functionality to your app and make it completely independent of iCal and EventKit.
Here are a couple of projects which could help ...