UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Debugging SwiftData Logs

Forums > SwiftUI

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.

  1. The app is a personal app so there is no install base yet.
  2. The data can easily be recreated
  3. I wanted to add a few new features that the old data design wouldn't support
  4. I had MAJOR performance issus with my CoreData design
  5. 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.

2      

This might stupid question, but if youve converted to SwiftData then why is the error message all about CoreData? Did you forget to delete / convert something?

2      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.