什么确切地构成“完整日历同步”在EKCalendar? [英] What exactly constitutes a "full calendar sync" in EKCalendar?

查看:180
本文介绍了什么确切地构成“完整日历同步”在EKCalendar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

EKCalendar 类的文档为 calendarIdentifier 属性指定了此属性:

The documentation for the EKCalendar class states this for the calendarIdentifier property:


与日历完全同步将丢失此标识符。你应该
有计划处理一个日历的标识符没有
可以通过缓存其他属性更长的时间。

A full sync with the calendar will lose this identifier. You should have a plan for dealing with a calendar whose identifier is no longer fetch-able by caching its other properties.

除了 calendarIdentifier

推荐答案

何时发生完全同步?

日历和提醒程式设计指南


如果日历数据库的更改发生在应用程序之外,
Event Kit就能检测到通知的更改,以便您的应用程序可以
适当地。使用事件工具包对日历项目所做的更改将
自动同步到相关日历(CalDAV,Exchange和
等)。

If a change to the Calendar database occurs from outside of your app, Event Kit is able to detect the change by notification so your app can act appropriately. Changes made to calendar items with Event Kit are automatically synced to the associated calendar (CalDAV, Exchange, and so on).

我在应用程式开启时看到「完全同步处理」事件的情况:

1。使用者将您的应用程式背景和打开日历应用程序。他更改日历名称,添加/编辑/删除活动,甚至删除某些日历。

2。用户在Mac上对iCloud日历应用一些更改。 iOS设备通知iCloud日历已更改,因此必须进行同步。

3。第三方应用程序接收静默通知,iOS在后台启动,应用程序创建一个日历基于通知的事件。

I see such scenarios of "full sync" events while your app is open:
1. User sends your app to background and opens Calendar app. He changes calendar name, adds/edits/deletes events or even removes some calendar.
2. User applies some changes to iCloud calendar on Mac. iOS device is notified that iCloud calendar was changed so it has to be synchronized.
3. Third-party app receives silent notification, iOS launches it in background, app creates some calendar event based on notification.

一般来说,这意味着完全同步事件可以随时发生。

In general it means that "full sync" event can happen at any time.

如何检测和处理完全同步事件?

观察日历数据库的外部更改以这种方式解释此问题:

How to detect and handle "full sync" event?
Observing External Changes to the Calendar Database explains this questions in this way:


另一个进程或应用程序可能修改日历
数据库您的应用程式正在执行。如果您的应用程式撷取日历
活动或提醒,您必须在日历资料库中注册

的变更通知。通过这样做,您可以确保日历
和您向用户显示的提醒信息是最新的。

It’s possible for another process or app to modify the Calendar database while your app is running. If your app fetches calendar events or reminders, you should register to be notified about changes to the Calendar database. By doing so, you ensure that the calendar and reminder information you display to the user is current.

注册此类通知的示例:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(storeChanged:)
                                             name:EKEventStoreChangedNotification
                                           object:eventStore];

我认为重新创建 EKCalendar classes和recache calendarIdentifier

I think it makes sense to recreate instances of EKCalendar classes and recache calendarIdentifier if needed.

除了calendarIdentifier之外,哪些属性可以更改?

我找不到有关此问题的任何文档。但是由于日历甚至在某些时候不存在(例如用户在日历应用程序中手动删除它),则 EKCalendar 对象的任何属性在完全同步

What properties are liable to change besides the calendarIdentifier?
I can't find any documentation about this question. But since calendar can even doesn't exist at some moment (for example user manually removes it in Calendar app) then any property of EKCalendar object can be invalid after "full sync" event happens.

有关详细信息和详细信息,请阅读上述链接。

Also it makes sense to read above links for more information and details.

这篇关于什么确切地构成“完整日历同步”在EKCalendar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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