iCloud & Data

RSS for tag

Learn how to integrate your app with iCloud and data frameworks for effective data storage

CloudKit Documentation

Posts under iCloud & Data subtopic

Post

Replies

Boosts

Views

Activity

Is iCloud sync working?
Hello, I tried to validate if my app was properly syncing to the cloud. To test this, I created some data in the app, and then deleted the app, and reinstalled. I was expecting the data to still exist but it isn't. Is this a valid test or is the data expected to be deleted when app is deleted?
1
0
150
Mar ’25
How to Delete Tips from CloudKit?
Hi! I use Tips with CloudKit and it works very well, however when a user want to remove their data from CloudKit, how to do that? In CoreData with CloudKit area, NSPersistentCloudKitContainer have purgeObjectsAndRecordsInZone to delete both local managed objects and CloudKit records, however there is no information about the TipKit deletion. Does anyone know ideas?
2
0
347
Mar ’25
Schema Migrations with CloudKit Not Working
I have not had any successful Schema Migration with CloudKit so far so I'm trying to do with with just very basic attributes, with multiple Versioned Schemas This is the code in my App Main var sharedModelContainer: ModelContainer = { let schema = Schema(versionedSchema: AppSchemaV4.self) do { return try ModelContainer( for: schema, migrationPlan: AppMigrationPlan.self, configurations: ModelConfiguration(cloudKitDatabase: .automatic)) } catch { fatalError("Could not create ModelContainer: \(error)") } }() var body: some Scene { WindowGroup { ItemListView() } .modelContainer(sharedModelContainer) } And this is the code for my MigrationPlan and VersionedSchemas. typealias Item = AppSchemaV4.Item3 enum AppMigrationPlan: SchemaMigrationPlan { static var schemas: [any VersionedSchema.Type] { [AppSchemaV1.self, AppSchemaV2.self, AppSchemaV3.self, AppSchemaV4.self] } static var stages: [MigrationStage] { [migrateV1toV2, migrateV2toV3, migrateV3toV4] } static let migrateV1toV2 = MigrationStage.lightweight( fromVersion: AppSchemaV1.self, toVersion: AppSchemaV2.self ) static let migrateV2toV3 = MigrationStage.lightweight( fromVersion: AppSchemaV2.self, toVersion: AppSchemaV3.self ) static let migrateV3toV4 = MigrationStage.custom( fromVersion: AppSchemaV3.self, toVersion: AppSchemaV4.self, willMigrate: nil, didMigrate: { context in // Fetch all Item1 instances let item1Descriptor = FetchDescriptor<AppSchemaV3.Item1>() let items1 = try context.fetch(item1Descriptor) // Fetch all Item2 instances let item2Descriptor = FetchDescriptor<AppSchemaV3.Item2>() let items2 = try context.fetch(item2Descriptor) // Convert Item1 to Item3 for item in items1 { let newItem = AppSchemaV4.Item3(name: item.name, text: "Migrated from Item1 on \(item.date)") context.insert(newItem) } // Convert Item2 to Item3 for item in items2 { let newItem = AppSchemaV4.Item3(name: item.name, text: "Migrated from Item2 with value \(item.value)") context.insert(newItem) } try? context.save() } ) } enum AppSchemaV1: VersionedSchema { static var versionIdentifier: Schema.Version = Schema.Version(1, 0, 0) static var models: [any PersistentModel.Type] { [Item1.self] } @Model class Item1 { var name: String = "" init(name: String) { self.name = name } } } enum AppSchemaV2: VersionedSchema { static var versionIdentifier: Schema.Version = Schema.Version(2, 0, 0) static var models: [any PersistentModel.Type] { [Item1.self] } @Model class Item1 { var name: String = "" var date: Date = Date() init(name: String) { self.name = name self.date = Date() } } } enum AppSchemaV3: VersionedSchema { static var versionIdentifier: Schema.Version = Schema.Version(3, 0, 0) static var models: [any PersistentModel.Type] { [Item1.self, Item2.self] } @Model class Item1 { var name: String = "" var date: Date = Date() init(name: String) { self.name = name self.date = Date() } } @Model class Item2 { var name: String = "" var value: Int = 0 init(name: String, value: Int) { self.name = name self.value = value } } } enum AppSchemaV4: VersionedSchema { static var versionIdentifier: Schema.Version = Schema.Version(4, 0, 0) static var models: [any PersistentModel.Type] { [Item1.self, Item2.self, Item3.self] } @Model class Item1 { var name: String = "" var date: Date = Date() init(name: String) { self.name = name self.date = Date() } } @Model class Item2 { var name: String = "" var value: Int = 0 init(name: String, value: Int) { self.name = name self.value = value } } @Model class Item3 { var name: String = "" var text: String = "" init(name: String, text: String) { self.name = name self.text = text } } } My experiment was: To create Items for every version of the schema Updating the typealias along the way to reflect the latest Item version. Updating the Schema in my ModelContainer to reflect the latest Schema Version. By AppSchemaV4, I have expected all my Items to be displayed/migrated to Item3, but it does not seem to be the case. I can only see newly created Item3 records. My question is, is there something wrong with how I'm doing the migrations? or are migrations not really working with CloudKit right now?
1
0
349
Mar ’25
iOS 17.2 Update, Confusing SwiftData Update !
Hi, Before the iOS 17.2 update the saving behavior of SwiftData was very straightforward, by default it saves to persistence storage and can be configured to save in memory only. Now it saves to memory by default and to make it save to persistence storage we need to use modelContext.Save(). But if we don't quit the App the changes will be saved after a while to persistence storage even without running modelContext.Save() ! How confusing can that be for both developer and the user ! Am I missing something here ? -- Kind Regards
3
0
380
Mar ’25
dual predicate search using CoreData
I have a very simple CoreData model that has 1 entity and 2 attributes. This code works fine: .onChange(of: searchText) { _, text in evnts.nsPredicate = text.isEmpty ? nil :NSPredicate(format: "eventName CONTAINS %@ " , text ) but I'd like to also search with the same text string for my second attribute (which is a Date). I believe an OR is appropriate for two conditions (find either one). See attempted code below: evnts.nsPredicate = text.isEmpty ? nil : NSPredicate(format: "(eventName CONTAINS %@) OR (dueDate CONTAINS %i) " , text ) This crashes immediately %@ does the same. Is there a way to accomplish this? How is SwiftUI not an option below?
6
0
307
Mar ’25
Request to manually associate my CloudKit container with my app ID
Hello, My app has had CloudKit enabled for a while, but it's not working. I get the error "Invalid bundle ID for container". Configure CloudKit in your project from TN3164 suggests changing to a new container. I tried changing to a new container, but this leads to data loss. The article recommends: "If your CloudKit container is already used in the production environment and switching to a new container leads to data loss, consider filing a feedback report with the following information to request manually associating your CloudKit container with your app ID." Where can I request this manual association? Is there anything else I can do? Thank you for your time and assistance. I’d appreciate a prompt resolution, as this issue is blocking our update. Looking forward to guidance.
2
0
479
Mar ’25
Swift 6 Concurrency errors with ModelActor, or Core Data actors
In my app, I've been using ModelActors in SwiftData, and using actors with a custom executor in Core Data to create concurrency safe services. I have multiple actor services that relate to different data model components or features, each that have their own internally managed state (DocumentService, ImportService, etc). The problem I've ran into, is that I need to be able to use multiple of these services within another service, and those services need to share the same context. Swift 6 doesn't allow passing contexts across actors. The specific problem I have is that I need a master service that makes multiple unrelated changes without saving them to the main context until approved by the user. I've tried to find a solution in SwiftData and Core Data, but both have the same problem which is contexts are not sendable. Read the comments in the code to see the issue: /// This actor does multiple things without saving, until committed in SwiftData. @ModelActor actor DatabaseHelper { func commitChange() throws { try modelContext.save() } func makeChanges() async throws { // Do unrelated expensive tasks on the child context... // Next, use our item service let service = ItemService(modelContainer: SwiftDataStack.shared.container) let id = try await service.expensiveBackgroundTask(saveChanges: false) // Now that we've used the service, we need to access something the service created. // However, because the service created its own context and it was never saved, we can't access it. let itemFromService = context.fetch(id) // fails // We need to be able to access changes made from the service within this service, /// so instead I tried to create the service by passing the current service context, however that results in: // ERROR: Sending 'self.modelContext' risks causing data races let serviceFromContext = ItemService(context: modelContext) // Swift Data doesn't let you create child contexts, so the same context must be used in order to change data without saving. } } @ModelActor actor ItemService { init(context: ModelContext) { modelContainer = SwiftDataStack.shared.container modelExecutor = DefaultSerialModelExecutor(modelContext: context) } func expensiveBackgroundTask(saveChanges: Bool = true) async throws -> PersistentIdentifier? { // Do something expensive... return nil } } Core Data has the same problem: /// This actor does multiple things without saving, until committed in Core Data. actor CoreDataHelper { let parentContext: NSManagedObjectContext let context: NSManagedObjectContext /// In Core Data, I can create a child context from a background context. /// This lets you modify the context and save it without updating the main context. init(progress: Progress = Progress()) { parentContext = CoreDataStack.shared.newBackgroundContext() let childContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType) childContext.parent = parentContext self.context = childContext } /// To commit changes, save the parent context pushing them to the main context. func commitChange() async throws { // ERROR: Sending 'self.parentContext' risks causing data races try await parentContext.perform { try self.parentContext.save() } } func makeChanges() async throws { // Do unrelated expensive tasks on the child context... // As with the Swift Data example, I am unable to create a service that uses the current actors context from here. // ERROR: Sending 'self.context' risks causing data races let service = ItemService(context: self.context) } } Am I going about this wrong, or is there a solution to fix these errors? Some services are very large and have their own internal state. So it would be very difficult to merge all of them into a single service. I also am using Core Data, and SwiftData extensively so I need a solution for both. I seem to have trapped myself into a corner trying to make everything concurrency save, so any help would be appreciated!
6
0
714
Mar ’25
How often iCloud will sync with local swiftData?
Hi, I have developed a calendar app with swiftData. I have set it to sync iCloud. When testing it, it seems that everything is fine. But after it's released, today, I uninstalled it and reinstalled it again. And I found that iCloud hasn't sync with local swiftData for six days. I have lost six days agenda and relevant information. I have checked the document, and it's said that there is no method to force to sync with iCloud. How to solve the issue? I think that the users can't forgive that it hasn't synced for six days. Best Wishes,
3
0
299
Mar ’25
CKSyncEngine: Can Long-Offline Devices Miss CloudKit Change Notifications?
Problem Description: When a device (Device 2) stays offline for an extended period after a record is deleted from another synced device (Device 1) via CloudKit, is it possible for Device 2 to miss the deletion notification when it reconnects, even when using CKSyncEngine? This scenario raises questions about whether CKSyncEngine can reliably sync changes if CloudKit archives or purges metadata related to deletions during the offline period. Steps to Reproduce: At time t0: · Device 1 and Device 2 sync successfully via CKSyncEngine (shared record RecordA). Device 2 goes offline. On Device 1: · Delete RecordA; sync completes via CKSyncEngine. Wait for a duration potentially exceeding CloudKit’s change retention window (if such a window exists). Bring Device 2 back online. Observe synchronization: · Expected Behavior: CKSyncEngine removes RecordA from Device 2. · Observed Behavior: RecordA remains on Device 2. Key Questions: Under these conditions, can Device 2 permanently miss the deletion event due to CloudKit’s internal metadata management? Is there a documented retention policy for CloudKit’s change history, and how does CKSyncEngine handle scenarios where this history is truncated? What is the recommended pattern to ensure no events are missed, regardless of offline duration? Clarifications Needed: · If CloudKit does discard deletion metadata after a period, is this considered a framework limitation, or should developers implement additional safeguards? · Does CKSyncEngine log warnings or errors when it detects incomplete sync histories? Environment: · CKSyncEngine with SQLite · CloudKit Private Database · iOS/macOS latest versions Thank you for clarifying how CKSyncEngine is designed to handle this edge case!
1
0
236
Feb ’25
Swiftdata - reset the database from archived files with swiftui without a app restart
HI, swiftdata is new to me and any help would be appreciated. In my swiftui app I have a functionality that reinstates the database from an archive. I first move the three database files (database.store datebase.store-wal and database.store-shm) to a new name (.tmp added for backup incase) and then copy the Archived three files to the same location. the move creates the following errors: " BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode renamed while in use: /private/var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store.tmp invalidated open fd: 4 (0x20)" I get the same message in console for all three files. then I reinitialise the model container and get no errors as my code below .... let schema = Schema([....my different models are here]) let config = ModelConfiguration("database", schema: schema) do { // Recreate the container with the same store URL let container = try ModelContainer(for: schema, configurations: config) print("ModelContainer reinitialized successfully!") } catch { print("Failed to reinitialize ModelContainer: (error)") } } I get the success message but when I leave the view (backup-restore view) to the main view I get: CoreData: error: (6922) I/O error for database at /var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store. SQLite error code:6922, 'disk I/O error' and error: SQLCore dispatchRequest: exception handling request: &lt;NSSQLFetchRequestContext: 0x302920460&gt; , I/O error for database at /var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store. SQLite error code:6922, 'disk I/O error' with userInfo of { NSFilePath = "/var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store"; NSSQLiteErrorDomain = 6922; } error: -executeRequest: encountered exception = I/O error for database at /var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store. SQLite error code:6922, 'disk I/O error' with userInfo = { NSFilePath = "/var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store"; NSSQLiteErrorDomain = 6922; } CoreData: error: SQLCore dispatchRequest: exception handling request: &lt;NSSQLFetchRequestContext: 0x302920460&gt; , I/O error for database at /var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store. SQLite error code:6922, 'disk I/O error' with userInfo of { NSFilePath = "/var/mobile/Containers/Data/Application/499A6802-02E5-4547-83C4-88389AEA50F5/Library/Application Support/database.store"; NSSQLiteErrorDomain = 6922; } Can anyone let me know how I should go about this - reseting the database from old backup files by copying over them. or if there is a way to stop the database and restart it with the new files in swiftdata my app is an ios app for phone and ipad
2
0
665
Feb ’25
NSMigrationManager.migrateStore with NSPersistentHistoryTrackingKey
I am implementing a custom migration, and facing an issue while implementing a WAL checkpointing. Here is the code for WAL checkpointing func forceWALCheckpointingForStore(at storeURL: URL, model: NSManagedObjectModel) throws { let persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: model) let options = [NSSQLitePragmasOption: ["journal_mode": "DELETE"]] let store = try persistentStoreCoordinator.addPersistentStore(type: .sqlite, at: storeURL, options: options) try persistentStoreCoordinator.remove(store) } When the coordinator tries to add the store I am getting the following error fault: Store opened without NSPersistentHistoryTrackingKey but previously had been opened with NSPersistentHistoryTrackingKey - Forcing into Read Only mode store My questions are Is it really necessary to force WAL checkpointing before migration? I am expecting NSMigrationManager to handle it internally. I am assuming this because the migrateStore function asks for the sourceType where I am passing StoreType.sqlite If checkpointing is required, then how do I address the original issue Note: Since my app supports macOS 13, I am not able to use the newly introduced Staged migrations. There is similar question on Stackoverflow that remains unanswered. https://stackoverflow.com/q/69131577/1311902
6
0
579
Feb ’25
CloudKit Sharing Issue: "Unknown client: ChoreOrganizer"
I'm experiencing a persistent issue with CloudKit sharing in my iOS application. When attempting to present a UICloudSharingController, I receive the error message "Unknown client: ChoreOrganizer" in the console. App Configuration Details: App Name: ChoreOrganizer Bundle ID: com.ProgressByBits.ChoreOrganizer CloudKit Container ID: iCloud.com.ProgressByBits.ChoreOrganizer Core Data Model Name: ChoreOrganizer.xcdatamodeld Core Data Entity: Chore Error Details: The error "Unknown client: ChoreOrganizer" occurs when I present the UICloudSharingController This happens only on the first attempt to share; subsequent attempts during the same app session don't show the error but sharing still doesn't work All my code executes successfully without errors until UICloudSharingController is presented Implementation Details: I'm using NSPersistentCloudKitContainer for Core Data synchronization and UICloudSharingController for sharing. My implementation creates a custom CloudKit zone, saves both a record and a CKShare in that zone, and then presents the sharing controller. Here's the relevant code: @MainActor func presentSharing(from viewController: UIViewController) async throws { // Create CloudKit container let container = CKContainer(identifier: containerIdentifier) let database = container.privateCloudDatabase // Define custom zone ID let zoneID = CKRecordZone.ID(zoneName: "SharedChores", ownerName: CKCurrentUserDefaultName) do { // Check if zone exists, create if necessary do { _ = try await database.recordZone(for: zoneID) } catch { let newZone = CKRecordZone(zoneID: zoneID) _ = try await database.save(newZone) } // Create record in custom zone let recordID = CKRecord.ID(recordName: "SharedChoresRoot", zoneID: zoneID) let rootRecord = CKRecord(recordType: "ChoreRoot", recordID: recordID) rootRecord["name"] = "Shared Chores Root" as CKRecordValue // Create share let share = CKShare(rootRecord: rootRecord) share[CKShare.SystemFieldKey.title] = "Shared Tasks" as CKRecordValue // Save both record and share in same operation let recordsToSave: [CKRecord] = [rootRecord, share] _ = try await database.modifyRecords(saving: recordsToSave, deleting: []) // Present sharing controller let sharingController = UICloudSharingController(share: share, container: container) sharingController.delegate = shareDelegate // Configure popover if let popover = sharingController.popoverPresentationController { popover.sourceView = viewController.view popover.sourceRect = CGRect( x: viewController.view.bounds.midX, y: viewController.view.bounds.midY, width: 1, height: 1 ) popover.permittedArrowDirections = [] } viewController.present(sharingController, animated: true) } catch { throw error } } Steps I've already tried: Verified correct bundle ID and container ID match in all places (code, entitlements file, Developer Portal) Added NSUbiquitousContainers configuration to Info.plist Ensured proper entitlements in the app Created and configured proper provisioning profiles Tried both default zone and custom zone for sharing Various ways of saving the record and share (separate operations, same operation) Cleaned build folder, deleted derived data, reinstalled the app Tried on both simulator and physical device Confirmed CloudKit container exists in CloudKit Dashboard with correct schema Verified iCloud is properly signed in on test devices Console Output: 1. Starting sharing process 2. Created CKContainer with ID: iCloud.com.ProgressByBits.ChoreOrganizer 3. Using zone: SharedChores 4. Checking if zone exists 5. Zone exists 7. Created record with ID: <CKRecordID: 0x3033ebd80; recordName=SharedChoresRoot, zoneID=SharedChores:__defaultOwner__> 8. Created share with ID: <CKRecordID: 0x3033ea920; recordName=Share-C4701F43-7591-4436-BBF4-6FA8AF3DF532, zoneID=SharedChores:__defaultOwner__> 9. About to save record and share 10. Records saved successfully 11. Creating UICloudSharingController 12. About to present UICloudSharingController 13. UICloudSharingController presented Unknown client: ChoreOrganizer Additional Information: When accessing the CloudKit Dashboard, I can see that data is being properly synced to the cloud, indicating that the basic CloudKit integration is working. The issue appears to be specific to the sharing functionality. I would greatly appreciate any insights or solutions to resolve this persistent "Unknown client" error. Thank you for your assistance.
5
0
643
Feb ’25
Cloudkit not synching across devices after latest ios update
After a recent iOS update, my app is not synching between devices. I'm not seeing or getting any errors. CLoudKit Logs show activity, but it's not happening realtime. Even if I close and reopen the app, it won't sync between devices. It almost looks like it only has local storage now and CloudKit is not working on it anymore. STEPS TO REPRODUCE Use app on two devices with the same Apple ID. Create a user and one device and it won't show up on the other device. Vice Versa.
1
0
528
Feb ’25
EXC_BAD_INSTRUCTION
public static func fetch(in context: NSManagedObjectContext, configurationBlock: (NSFetchRequest) -&amp;gt; () = { _ in }) -&amp;gt; [Self] { let request = NSFetchRequest(entityName: Self.entityName) configurationBlock(request) return try! context.fetch(request) } context.fetch(request), 'fetch' function has error. Thread 24: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
7
0
657
Feb ’25
Int128 fail in @Model with SwiftData
Swift recently added support for Int128. However, they do need NOT seem to be supported in SwiftData. Now totally possible I'm doing something wrong too. I have the project set to macOS 15 to use a UInt128 in @Model class as attribute. I tried using a clean Xcode project with Swift Data choosen in the macOS app wizard. Everything compiles, but it fails at runtime in both my app and "Xcode default" SwiftData: SwiftData/SchemaProperty.swift:380: Fatal error: Unexpected property within Persisted Struct/Enum: Builtin.Int128 with the only modification to from stock is: @Model final class Item { var timestamp: Date var ipv6: UInt128 init(timestamp: Date) { self.timestamp = timestamp self.ipv6 = 0 } } I have tried both Int128 and UInt128. Both fails exactly the same. In fact, so exactly, when using UInt128 it still show a "Int128" in error message, despite class member being UInt128 . My underlying need is to store an IPv6 addresses with an app, so the newer UInt128 would work to persist it. Since Network Framework IPv6Address is also not compatible, it seems, with SwiftData. So not a lot of good options, other an a String. But for an IPv6 address that suffers from that same address can take a few String forms (i.e. "0000:0000:0000:0000:0000:0000:0000:0000" =="0:0:0:0:0:0:0:0" == "::") which is more annoying than having a few expand Int128 as String separator ":". Ideas welcomed. But potentially a bug in SwiftData since Int128 is both a Builtin and conforms to Codable, so from my reading it should work.
7
0
491
Feb ’25
Async Data with iCloud
DESCRIPTION I have an App use iCloud to save data. The App had a CoreData ManagedObject 'Product', 'Product' Object had an attribute name 'count' and it is a Double Type. I need to synchronises 'count' property across multiple devices. for example: I have a devices A、B. A device set 'Product.count' = 100. B device set 'Product.count' = 50. I hope the 'Product.count' == 150 that results. how to synchronises the 'Product.count' == 150 for multiple devices. If I have more devices in future, How to get the latest 'Product.count' that it is correct result.
4
0
606
Feb ’25
Records or Fields are Missing or Corrupt in Users Private CloudKit Databases (Recent Changes to CloudKit?)
Hi all, I've contacted Apple about this privately but I wanted to post this publicly too just to see if anyone else is experiencing the same issue. We use CloudKit to store "documents" (we'll call them) for our users. We use it directly, not via CoreData etc but through the lower level APIs. This has been working great for the last 9 months or so. Since a few days ago we've started receiving reports from users that their data has disappeared without a trace from their app. Obviously this is very serious and severe for us. We keep a local copy of the users data but if CloudKit tells us this data has been deleted we remove that local copy to keep in sync. Nothing has changed client side in terms of our code, and the only way we can see that could cause this, is a fetch that we perform asking for a list of the users "documents" is returning no rows/results, or possibly returning rows with invalid or missing fields. We have about 30,000 active users per day (1.5m requests/day) using CloudKit and we have only a handful of reports of this. Again this only started happening this week after 9 months of good service. Has anyone else noticed anything "strange" lately, fetches returning empty? fields missing? Is anyone at Apple aware of any recent changes to CloudKit? or outages? We're really unsure how or who should handle this and who we can escalate to? Any help appreciated. We have a workaround/mitigation on the way through review at the moment but this is a really big problem for us if we can't rely on CloudKit to remember users data reliably.
1
0
583
Feb ’25
SwiftData migration error: NSCloudKitMirroringDelegate are not reusable
Hello everyone, I used SwiftData for v1 of an app and am now trying to make changes to the schema for v2. I created the v2 schema that adds a property to one of the models. I need to populate the new property so I made a custom migration using didMigrate. However that doesn't seem to matter what I do in the migration because creating the ModelContainer throws an error before didMigrate ever gets called. The error is: Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={NSLocalizedFailureReason=Instances of NSCloudKitMirroringDelegate are not reusable and should have a lifecycle tied to a given instance of NSPersistentStore.} Higher up in the Xcode output I see things like this (in order): Request 'D25A8CB8-7341-4FA8-B2F8-3DE2D35B5273' was cancelled because the store was removed from the coordinator. BUG IN CLIENT OF CLOUDKIT: Registering a handler for a CKScheduler activity identifier that has already been registered CloudKit setup failed because it couldn't register a handler for the export activity. There is another instance of this persistent store actively syncing with CloudKit in this process. How can I know from this output what I am doing incorrectly? Any idea what I should take a look at or try to do differently? This is a simple app with three models and nothing fancy. The only change in the schema is to add a property. The new property is declared as optional and has an inverse that is also declared as optional. Thanks for any insight!
13
6
996
Feb ’25