首页 > 解决方案 > 旧核心数据同步到 CloudKit “iCloud”

问题描述

我有一个使用 Core Data 的应用程序,但现在我将 CloudKit 添加到我的应用程序中,并且在同步所有旧的 Core Data 时遇到了问题。有没有人有同样的问题?有谁知道如何同步旧的核心数据?

func fetch(completion: (_ comple: Bool) -> ()) {
        guard let managedContext = appDelegate?.persistentContainer.viewContext else { return }
        let fetchRequest = NSFetchRequest<Goal>(entityName: "Goal")
        do {
            goalPasswords = try managedContext.fetch(fetchRequest)
            completion(true)
        } catch {
            debugPrint("Fetch Error \(error.localizedDescription)")
            completion(false)
        }
    }

标签: swiftcore-dataicloudcloudkit

解决方案


推荐阅读