简体   繁体   中英

How to access iCloud as core data for iCloud is deprecated

I am working on an app using core data as I thought I could use sync functionality provided by core data for iCloud for syncing data between iPad and iPhone, now it is deprecated.

I came across CloudKit but it is mainly to create and manage data that can be consumed by community of end users but not just one like chat apps. My app is only for single user so that user can sync their data between their apple eco system devices.

I am new to iOS development so it would be helpful to know which technology will meet my requirements.

In short, can you please suggest what should I use

  1. If have to store data on phone for offline use
  2. Then sync it across devices if user have say iPhone, iPad, and iWatch

PS Can you please suggest something that doesn't need the user to be signed into iCloud while saving the data.

The CoreData/iCloud integration is deprecated in iOS 10 / macOS Sierra, and there is no replacement (at least so far).

Way forward so far :

Note that CoreData/iCloud integration will still be working for some time in the future. Apps that are using it will not suddenly stop working.

You should take a look at the videos from the latest WWDC. Here is something about CloudKit Best Practices and whats new in cloud kit CloudKit really have some nice out of the box solutions and you dont have to bother about security. Also the newest functionality enables you to use notifications for synchronising apps using the same apple id and even beyond, as the user can now opt to share certain data.

Depending how much data you are syncing, NSUbiquitousKeyValueStore.default() is also an option. But only for very less data

Apple just released a new container for Core Data that can sync across devices with iCloud.

Get started here: https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit/setting_up_core_data_with_cloudkit

Note, this requires iOS 13.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM