My current solution is to define the state variable as @Published my model and in my swiftui view's onReceive method I apply the textual appearances through variables such as text, color etc. defined with @State property wrappers in the View. Still not sure if it is a "preferred" way.
Post
Replies
Boosts
Views
Activity
Hi I am newbie to the CloudKit and have tried to convert CoreDataCloudKitDemo to work with public database after watching the wwdc20-10650. I have the following error outputs. It doesn't help much, any suggestions? Thank you.
<CKError 0x600002825770: "Partial Failure" (2/1011); "Failed to modify some records"; partial errors: {
CDFAKETag81FFFFC1-FD86-4121-B201-08A1F761B2AB:(defaultZone:defaultOwner) = <CKError 0x6000028de730: "Internal Error" (1/1000); "No authToken received for asset">
CDFAKEImageDataC8B4705B-EB7D-4F8B-A21D-A9EDB303A74E:(defaultZone:defaultOwner) = <CKError 0x6000028de430: "Internal Error" (1/1000); "No authToken received for asset">
CDFAKEPost620D3755-64F5-49A6-8793-16D8AB5F8154:(defaultZone:defaultOwner) = <CKError 0x6000028de9d0: "Internal Error" (1/1000); "No authToken received for asset">
... 2 "Batch Request Failed" CKError's omited ...
CoreDataCloudKitDemo[5308:617130] [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate recoverFromPartialError:forStore:inMonitor:]blockinvoke(1943): <NSCloudKitMirroringDelegate: 0x600001dacdd0>: Found unknown error as part of a partial failure: <CKError 0x6000028d1e90: "Batch Request Failed" (22/2024); "Record <CKRecordID: 0x7ff7abeb3460; recordName=CDFAKEAttachment6F83B3CB-184C-4E89-8CB3-7CCC488C05BE, zoneID=defaultZone:defaultOwner> will not be saved because of previous error in atomic zone">
Unable to initialize CloudKit schema: A Core Data error occurred.
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:]block_invoke(2150): <NSCloudKitMirroringDelegate: 0x600001dacdd0> - Ignoring remote change notification because it didn't change any entities tracked by persistent history: <NSSQLCore: 0x7fd3356154a0>
Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringExportRequest: 0x600002824d20> 0F6F3A38-6A55-4900-A114-811C997A3841' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringExportRequest: 0x600002824d20> 0F6F3A38-6A55-4900-A114-811C997A3841' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'.}
Just got another model working by mostly try and error. Used with CloudKit is checked, that is inside Cloud configuration's inspector
let defaultDirectoryURL = NSPersistentContainer.defaultDirectoryURL()
let cloudStoreURL = defaultDirectoryURL.appendingPathComponent("Cloud.sqlite")
let cloudStoreDescription = NSPersistentStoreDescription(url: cloudStoreURL)
cloudStoreDescription.configuration = "Cloud"
cloudStoreDescription.cloudKitContainerOptions =
NSPersistentCloudKitContainerOptions(
containerIdentifier: "iCloud.com.example.app")
cloudStoreDescription.cloudKitContainerOptions?.databaseScope = .public
cloudStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
cloudStoreDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
let localStoreURL = defaultDirectoryURL.appendingPathComponent("Local.sqlite")
let localStoreDescription = NSPersistentStoreDescription(url: localStoreURL)
localStoreDescription.configuration = "Local"
persistentContainer.persistentStoreDescriptions = [ cloudStoreDescription, localStoreDescription ]
persistentContainer.loadPersistentStores(completionHandler: { (_, error) in
guard let error = error as NSError? else { return }
fatalError("###\(#function): Failed to load persistent stores:\(error)")
})
persistentContainer.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
persistentContainer.viewContext.transactionAuthor = appTransactionAuthorName
persistentContainer.viewContext.automaticallyMergesChangesFromParent = true
do {
try persistentContainer.viewContext.setQueryGenerationFrom(.current)
} catch {
fatalError("###\(#function): Failed to pin viewContext to the current generation:\(error)")
}
}
As far as I understand your post, I'd approach and try it in the CreateML in the following way:
CGPoint is a struct and can be initialized with doubles or ints or cgfloats. Assuming double, I would suggest that you create a column for touch locations as X1 ,Y1, X2, Y2, Y3, Y4 in series, and last column as your target (ellipse, triangle, rectangle). Each row will be your series of touches and the number of columns will be equal to the longest of your series. The shorter series can have 0 in unused columns.
can you post an example?
This is explained in the WWDC20 video "sync a core data store with cloudkit public database"