Have you figured out the solution? I seem to be having the same or very similar problem. I am using watchOS 7.0, Xcode 12.0, iOS 14.
Post
Replies
Boosts
Views
Activity
I'm getting the same output. It's strange and I don't see anything in my core data model that should be an issue with lightweight migration.
The pre-existing data does not sync. Only the newly-added data syncs. What I am doing is creating a struct for every core data entity, stuffing those structs with the core data and then going from structs to core data. My app is old and its store file is in the Document directory whereas the new store files are located in the Library directory. Do you think that your app is that old?
Actually, I've come up with another scheme. I have created Decodable structs for each core data entity. The new core data's store file location is in the Library folder whereas the old core data's store file is located in the Documents directory. I plan on saving every entity in structs and then go from structs to core data using two managed object contexts, one to grab the data and the other to save. This will allow that data to sync.
It looks like this issue has gone away with the new beta version of Xcode 12. Thanks for looking into this.
My app is so old, the sqlite file is stored in the Documents directory and not the Library/"Application Support" directory as the new files are. I've created a struct for every entity in my core data and made the structs Codable. NSManagedObjects are not Codable. There were some issues as NSNumbers are not Codable, but I replaced those with Ints in the structures. I have written methods which stuff the structs from core data and have written methods which stuff the core data entities from the structs. I've also written methods to encode and decode the struct data using the JSON encoder/decoder. The plan is to grab the data from the old directory, put all of the core data objects into structs and then put the struct data into the new store file. That will sync the data. This will require a separate ManagedObjectContext for the old data. I also plan on saving the encoded data out for the user in iCloud Drive as backup files and will allow the user to restore their data from a backup file. Whew!
It doesn't happen when the .wheels style is used. But it does in .automatic and .inline.
I have uploaded my project. The title of the report is 'CompositionalLayout] Invalid absolute dimension, must be > 0.0. (Xcode 12)'.
If you add a bool, or a uuid in my case, then you will have double entities. But you can then delete any entity without a uuid (or bool) and that should sync to the other devices. I don't know this for sure, but it seems reasonable.
Try adding a UUID attribute to all of your entities in the model. You'll have to migrate, but that should be easy as it's only adding one attribute per entity. Then fetch every entity and add the UUID to every managed object. Then save. I have done this with a sample project and it seemed to work. You might want to try this on an experimental project first. Another way would be to have two managed object contexts and copy each one and save in the context with the CloudKit store. Although relationships are an issue.
Thanks!
Thanks for the answer. That correlates with the most recent WWDC code.
Looks like the newest version of the WWDC code answers my question. Thanks to Apple.
I set one up programmatically within SceneDelegate.
It's happening again.