Post

Replies

Boosts

Views

Activity

Reply to Mac Assigning NSManagedObject to NSPersistentStore
It appears to be related explicitly to persistent store. Removing the assign call allows the object to be created, modified, saved as expected. Further, I tried to editing objects with the following code let managedObjectContext = managedObjectContext.child(with: .mainQueueConcurrencyType) let object = managedObjectContext.object(with: objectID) as! Object And this crashed with Thread 1: "Object 0x82018e630c8dd320 <x-coredata://E8D86530-2F0D-4680-98AC-D42B1FF23DE4/Object/p33> persistent store is not reachable from this NSManagedObjectContext's coordinator" Again, this isn't an issue for iOS, but it does appear to be an issue for both Mac and VisionOS. It's also not feasible to provide a minimal project that is minimal.
2w
Reply to Read, Write, and Consuming Files / URLs
After thinking about this some more, I'm not sure reading a store directly from the asset pack will solve my issue. The database get's updated regularly, so if there's an update that finishes downloading while the app is running, the original linked store will be destroyed and replaced with the new one. Which probably will crash the app.
Feb ’26
Reply to NSStagedMigrationManager Merging Steps
There was a few issues here. None of which are documented very well. And all crash with the same error message. (1) My orginal .xcdatamodel file didn't have a Core Data Model Identifier. Which lead to a crash with NSCustomMigrationStage, even though the versionChecksum are different. (2) The steps passed into NSStagedMigrationManager are not clear or documented. But it appears that if you pass the first version of the model into the steps, it crashes. (3) I'm using manual code generation for the model classes. So my goal was to switch the model names, then switch them back, so I didn't have to change anything. For some reason, stepping through the one migration step per app launch instead of all at once allowed for a successful migration. But running all steps threw an error. Turns out I could just rename the model classes with the _v2 suffix, and the only thing I needed to update was the string in the fetch request. Overall, to resolve this I added a model version identifier I duplicated the model version and incremented the model version identifier Deleted the final migration step that removed the entity versioning
Jan ’26