编程技术网

关注微信公众号,定时推送前沿、专业、深度的编程技术资料。

 找回密码
 立即注册

QQ登录

只需一步,快速开始

极客时间

CloudKit和Core在设备之间同步数据:CloudKit and Core sync data between devices

wachaudh 云计算 2022-5-10 14:56 11人围观

腾讯云服务器
CloudKit和Core在设备之间同步数据的处理方法

我基于核心数据创建了一个简单的 Notes 应用.现在,我想在用户设备之间添加同步.

I created a simple Notes app based on Core data. Now i want add sync between user devices.

以及我阅读的所有文章()说,我应该完全摆脱我的核心数据数据库,我的所有代码都将丢失,并使用 ICloud套件进行全部重做?

And all articles that i read (this, this) said that i should fully get rid of my core data database, and all my code will lost and rework all with ICloud kit?

无法将数据从 Core Data 同步到 ICloud 吗?如果我摆脱了核心数据,我的应用程序将如何离线运行?

The is no way to sync data from Core Data to ICloud ? And if i get rid of core data, how my app will work offline ?

并建议使用 ICloud sync

And please suggest good simple projects with ICloud sync

P.S.我用谷歌搜索了大约一个小时.不建议使用icloud,因此不建议与其同步.我很困惑现在如何在设备之间同步数据?

P.S. I googled about an hour. Icloud is deprecated so do sync with it is not recommended. I confused. How now i can sync data between devices??

问题解答

Core Data曾经具有iCloud同步功能,但是从iOS 10开始不推荐使用.它有几个问题,有时很严重.

Core Data used to have iCloud syncing, but it has been deprecated as of iOS 10. It had several problems, sometimes major.

Apple现在有一个叫做CloudKit的东西,这不是一回事.您可以使用CloudKit在设备之间同步数据.但这这并不意味着您应该删除核心数据.CloudKit仅同步;它并不是让您的应用将数据保存在设备上的替代品,它只是将数据发送到其他设备的一种方式.如果您使用的是CloudKit,还需要使用其他方法在本地设备上存储数据.

Apple now has something called CloudKit, which is not the same thing. You can use CloudKit to sync data between devices. But this does not mean that you should drop Core Data. CloudKit only syncs; it is not a replacement for having your app save data on the device, it's only a way to send data to other devices. If you're using CloudKit, you also need to use some other way to store data on the local device.

此外,它是"CloudKit".不是"ICloud Kit".我不知道为什么,但是正确命名这些名称很重要.

Also, it's "CloudKit". Not "ICloud Kit". I don't know why, but it's important to get the names right.

这篇关于CloudKit和Core在设备之间同步数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程技术网(www.editcode.net)!

腾讯云服务器 阿里云服务器
关注微信
^