I've been trying to build an example of NSStagedMigrationManager from some Core Data migration tests to replace a custom migration manager solution I'd constructed, without much success.
The Core Data model has seven model versions. Most support lightweight migration, but two of the migrations in the middle of the sequence used NSMappingModel.
In the first beta, just attempting to construct an NSStagedMigrationManager from the series of stages failed with an unrecognized selector. That no longer happens in b4, but I now get an error that "Duplicate version checksums across stages detected."
If I restrict myself to just the first three versions of the model (that only require lightweight migration), I can build the migration manager. But if I attempt to use it to migrate a persistent store, it fails somewhere in NSPersistentStoreCoordinator with a nilError.
The documentation is almost nonexistent for this process, and the WWDC session that introduced it isn't much more than a breezy overview. So maybe I'm holding it wrong?
(And, yes: FB12339663)
Post
Replies
Boosts
Views
Activity
Just for grins, I tried running the SwiftData generation tool on the existing Core Data model of a non-trivial app I've worked on for a decade or so. It's pretty substantial, and uses some more advanced features, so it seemed like an interesting test case.
One of the warnings that was not reported by the UI, but which showed up in the generated code was quite a few instances of this:
Entity inheritance on entity Bar (parent class Foo) is unsupported in SwiftData.
Now that I'm looking at the code examples more carefully, I see an awful lot of final class, which maybe should have raised a red flag sooner. But to the best of my recollection, none of the sessions outright said that inheritance (was or) was not supported. Core Data has supported this functionality for a long time (maybe since the beginning).
Assuming that this isn't supported in this first seed, are there plans to provide this functionality in the future? By the launch of iOS 17?
(For the record, this model has 93 entities, of which 34 have parent entities. 14 are abstract, which I gather is also not supported. 3 of the entities are both abstract and have parent entities.)
SwiftData provides a mechanism to periodically implicitly save a ModelContext to persistent storage.
This is an operation that could fail, as evidenced by the explicit save() method being marked as throws.
But what happens if the context attempts to save automatically, and that operation fails? Is there any mechanism for notifying the app? Any way for the app to recognize that it has happened, and to attempt to correct the situation? Presumably, it doesn't just crash (and lose the user's unsaved changes…).
For grins, I tried turning on strict concurrency checking in Xcode with one of our existing apps. We have a lot of work to do!
But one thing that I ran across that it's not clear to me how to resolve (possibly because I haven't been following all of the concurrency changes super closely) is an apparent conflict between the UIContentView & UIContentConfiguration protocols (which have no concurrency annotations) and our current implementations (since UIView is marked @MainActor). I feel like there must be something obvious I'm missing.
Stack Overflow post with example code: https://stackoverflow.com/questions/74214256/are-custom-uicontentview-uicontentconfiguration-implementations-incompatible-w
We have a few apps in the store that are working fine on iOS 15, but on iOS 16, have started exhibiting some strange crashes in Core Data. Specifically, we're seeing this happen at very different parts of the app:
CoreData: error: warning snapshot_get_value_as_object called on NULL
The top of the stack traces all appear fairly consistent, though sometimes all of the symbols on the stack are framework code, not our app:
#0 0x000000019447ba50 in snapshot_get_value_as_object ()
#1 0x00000001944ab724 in _PFFaultHandlerFulfillFault ()
#2 0x0000000194479798 in _PFFaultHandlerLookupRow ()
#3 0x00000001944a0cf4 in _PF_FulfillDeferredFault ()
As far as I can tell, there aren't any documented changes to Core Data in iOS 16 aside from CloudKit functionality, though there could certainly be internal changes in the framework itself.
I'm at something of a loss regarding how to try to isolate the cause of this issue and figure out how to fix it.
I've been working for the past day or so to add a very minor feature to one of our UIKit based apps using SwiftUI, as an experiment. Suddenly, this morning, previews stopped working, citing a build error that only occurs when building for preview:
Compiling failed: 'main' attribute cannot be used in a module that contains top-level code
I was editing the view when this started happening, but no fiddling I've done with it since has fixed the issue.
I have tried:
Reverting all changes in Git
Cleaning the build folder (repeatedly)
Touching both the file with the SwiftUI view, and the AppDelegate that's annotated with @main
Closing the project, and Xcode
The project builds and runs just fine: this error only occurs with previews.
I had been working in Xcode 12.5 beta 2 when the problem started, but it persists when I open the project in Xcode 12.3.
Is there some extra build cache that I can go purge?