While debugging CoreData and SwiftData logs are equally obtuse, I thoughtI would share a log I am trying to figure out right now. I've converted a simple app of mine from CoreData to SwiftData, for multiple reasons.
- The app is a personal app so there is no install base yet.
- The data can easily be recreated
- I wanted to add a few new features that the old data design wouldn't support
- I had MAJOR performance issus with my CoreData design
- I wanted to learn SwiftData
Having done the rewrite, and moving my images in one of the objects to @Attribute(.externalStorage) var cardFront: Data?
I had high hopes that my performance issue would be solved. So far it seems to actually be even slower than before. But I am sure that is for another post.
My issue now, is that I have deployed to testFlight so I can sync the data across my macs, iPhone, and iPad but I am not seeing the data sync consistently.
Looking at the logs in Xcode I am seeing the following message
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate finishedAutomatedRequestWithResult:](3555): Finished request '<NSCloudKitMirroringExportRequest: 0x282285720> 10CFB202-4F3F-451C-B9E4-9EA3BDE2A0E8' with result: <NSCloudKitMirroringResult: 0x280ea18c0> storeIdentifier: 9070B171-CA61-47E3-9A4E-024052F23ABD success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134406 "Request '10CFB202-4F3F-451C-B9E4-9EA3BDE2A0E8' was aborted because the mirroring delegate never successfully initialized due to error: <CKError 0x280f7e9a0: "Partial Failure" (2/1011); "Failed to modify some records"; uuid = 5A8EA50D-66B7-4E3A-9E26-0DCB1A2B3F0D; container ID = "iCloud.com.theapapp.cardtracker"; partial errors: {
5EC2A06B-6598-4840-81CA-31EE115AFC73:(com.apple.coredata.cloudkit.zone:__defaultOwner__) = <CKError 0x280f72700: "Invalid Arguments" (12/2006); server message = "invalid attempt to set value type STRING for field 'CD_cardFront' for type 'CD_Card', defined to be: BYTES"; op = C02500B40FB59CA0; uuid = 5A8EA50D-66B7-4E3A-9E26-0DCB1A2B3F0D>
... 107 "Batch Request Failed" CKErrors omitted ...
}>" UserInfo={NSLocalizedFailureReason=Request '10CFB202-4F3F-451C-B9E4-9EA3BDE2A0E8' was aborted because the mirroring delegate never successfully initialized due to error: <CKError 0x280f7e9a0: "Partial Failure" (2/1011); "Failed to modify some records"; uuid = 5A8EA50D-66B7-4E3A-9E26-0DCB1A2B3F0D; container ID = "iCloud.com.theapapp.cardtracker"; partial errors: {
5EC2A06B-6598-4840-81CA-31EE115AFC73:(com.apple.coredata.cloudkit.zone:__defaultOwner__) = <CKError 0x280f72700: "Invalid Arguments" (12/2006); server message = "invalid attempt to set value type STRING for field 'CD_cardFront' for type 'CD_Card', defined to be: BYTES"; op = C02500B40FB59CA0; uuid = 5A8EA50D-66B7-4E3A-9E26-0DCB1A2B3F0D>
... 107 "Batch Request Failed" CKErrors omitted ...
}>}
I am not sure what to do with this, as all of this appears to be abstracted away from me in SwiftData.
How can I learn how to correctly diagnosis and resolve these kinds of issues.