Xcode 13:“‘NSPersistentCloudKitContainerOptions’类型的值没有成员‘databaseScope’`

Max*_*gin 3 xcode core-data xcode13

升级到 Xcode 13.0 (13A233) 后,以下用于 Xcode 12 的代码

let publicOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: containerIdentifier)
publicOptions.databaseScope = .public
Run Code Online (Sandbox Code Playgroud)

产生错误:Value of type 'NSPersistentCloudKitContainerOptions' has no member 'databaseScope'

事实上,当我点击NSPersistentCloudKitContainerOptions它时,它显示了旧的(iOS 13)版本的CoreData框架,没有databaseScope.

我的部署目标是 iOS 14,它曾经与 Xcode 12 一起工作很长一段时间。此外,它现在在几个项目中被破坏,包括使用 Xcode 12 创建的项目,即最近的项目。如何解决这个问题?

Max*_*gin 14

import CloudKit显然,现在也需要databaseScope在 的班级中CoreData提供NSPersistentCloudKitContainerOptions