Synchronizing a local store to the cloud
Share data between a user’s devices and other iCloud users.
Overview
Configure the sample code project
Before you run the sample code project in Xcode, do the following:
In Xcode’s Project navigator, select the project, and click the Signing & Capabilities tab.
From the Team pop-up menu, choose your developer team.
In the Bundle Identifier field, enter a new bundle ID for the CoreDataCloudKitDemo target. The bundle identifier for the project has an associated App ID, so you need a unique identifier to create your own App ID. Use a reverse-DNS format for your identifier, as Preparing your app for distribution describes.
In the iCloud Capability Section, click the + button to create a new iCloud Container, or click a the checkbox next to an existing container you would like to use.
Select the CoreDataCloudKitDemoUnitTests target and use the Team pop-up menu to choose your developer team.
Xcode automatically generates provisioning profiles as needed. You can now build and run the CoreDataCloudKitDemo app or tests.
Run the CoreDataCloudKitDemo app
Select the CoreDataCloudKitDemo scheme.
Choose a destination. The CoreDataCloudKitDemo app supports the following destinations:
Any iOS simulator
Any iOS device
My Mac (Mac Catalyst)
Configuration options
To facilitate testing, the app supports the following configuration options the AppDelegate class parses into properties:
-CDCKDTestingSet to
1to store files in the special directoryTestStores, so that tests don’t overwrite user data.
-CDCKDAllowCloudKitSyncSet to
0to disable CloudKit sync during testing.
com.apple.CoreData.ConcurrencyDebugEnable Core Data multithreading assertions to verify all Core Data operations use the correct queue.