Xcode 15 & 16: macOS app suddenly stops running in simulator

I have been working on Task Management app for macOS (currently using maOS 15.0 on a M1 MacBook Pro) for a while. Nothing fancy, it uses SwiftUI and Core Data. My problem: I make changes to the app, then run it in the simulator and see if everything works as expected. This works fine for maybe three weeks, until at one point it suddenly stops working – I make a minor change, click "Run" in Xcode (this happens in Xcode 15.x and now Xcode 16), the app icon bounces in the dock, but then no window opens. The app is built and I can see in the console that there are the usual notifications, but I cannot use the simulator anymore. I tried cleaning the Build Folder, resetting the Computer, reinstalling Xcode – nothing helps. What occasionally helps is renaming the Bundle Identifier, but now I only got it to run the simulator once more, then it stopped working. The only solution I have is to manually rebuild the whole app under a new name – that is, recreating the Core Data model and all files, which I have done three times.

And now it stopped working again. Does anyone know why this could be? I think Xcode 16 gives me a notification I did not get from Xcode 15: "NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed"

I could not find anything on this. Any ideas are greatly appreciated.

Is it a Mac app ? If so, it does not run on simulator but directly on the Mac. Or there is something you don't tell.

I make a minor change

What change is it ? Even a minor change can create serious problems.

As it occurred in Xcode 15, problem not to search in Xcode 16.

Similar error here: https://forums.developer.apple.com/forums/thread/759500

PS: when you expose a problem, try to be very precise and avoid digressions that make reading more complex.

Sorry, I tried to be as precise as possible but I cannot pinpoint cause and effect here – I realize this all sounds rather vague.

I managed to work around the problem by renaming the path to where the app saves the database for Core Data in Debug mode. The simulator now has a wiped database and the app starts again, so I guess the issue is connected to the database.

Xcode 15 & 16: macOS app suddenly stops running in simulator
 
 
Q