SwiftData/DataUtilities.swift:1093: Fatal error: Unable to parse keypath for non-PersistentModel Type

My iOS Testflight App is crashing immediately after download/start (on all physical devices)

iOS Console says: SwiftData/DataUtilities.swift:1093: Fatal error: Unable to parse keypath for non-PersistentModel Type

The code is probably it is during

self.modelContainer = try ModelContainer(
    for: Model1.self, Model2.self, Model3.self, Model4.self,
    configurations:
        ModelConfiguration(isStoredInMemoryOnly: isPreview))
modelContainer.mainContext.autosaveEnabled = true

The app runs fine on physical devices in run scheme (debug or release)

I have no clue how to solve this. Any ideas?

Answered by THUB in 779623022

The Xcode Cloud TestFlight Build setting was set to "Latest Release or Beta" and Apple had updated its tool chain to Xcode 15.3 beta 2 (15E5188]) Switching back to Xcode 15.2 (15C500b) solved it.

Accepted Answer

The Xcode Cloud TestFlight Build setting was set to "Latest Release or Beta" and Apple had updated its tool chain to Xcode 15.3 beta 2 (15E5188]) Switching back to Xcode 15.2 (15C500b) solved it.

This happened for me with Xcode 15.3 beta 1 and beta 2, and I've just tested and it's still happening with Xcode 15.3 beta 3. I've reported this as FB13620516.

I have the same problem on the latest Xcode Beta, one interesting thing though: the bug happens on iOS 17.2 but not on 17.4. Maybe I will change the target version. I really hope this bug is not shipped into production as I will submit my Swift Students Challenge app tomorrow... Fingers Crossed :)

SwiftData/DataUtilities.swift:1093: Fatal error: Unable to parse keypath for non-PersistentModel Type
 
 
Q