Search code examples
xcodecore-dataxcode13

Xcode 13: `Value of type 'NSPersistentCloudKitContainerOptions' has no member 'databaseScope'`


After upgrading to Xcode 13.0 (13A233), the following code that used to work with Xcode 12

let publicOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: containerIdentifier)
publicOptions.databaseScope = .public

produces the error: Value of type 'NSPersistentCloudKitContainerOptions' has no member 'databaseScope'

And indeed when I click on NSPersistentCloudKitContainerOptions it shows the old (iOS 13) version of CoreData framework without databaseScope.

My deployment target is iOS 14 and it used to work with Xcode 12 for a long long time. Also, it is now broken in several projects, including the ones that were created with Xcode 12, i.e. rather recently. How to fix this?


Solution

  • Apparently, now it is required to import CloudKit as well to make databaseScope available in CoreData's NSPersistentCloudKitContainerOptions class.