Code signature not valid when running on Simulator in Xcode 16

I just upgraded to Version 16.0 (16A242d) and unfortunately the App that used to run perfectly fine on Xcode 15 is now broken. It crashes right after showing the Launch Screen on the Simulator. Here's the formatted error message in the Console:

dyld[80159]: Library not loaded: @rpath/AppName-iOS.debug.dylib
  Referenced from: <App ID> /path/to/AppName-iOS.app/AppName-iOS
  Reason: tried: '/path/to/DerivedData/AppName-iOS.debug.dylib' (no such file), 
          '/path/to/CoreSimulator/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection/AppName-iOS.debug.dylib' (no such file),
          '/path/to/AppName-iOS.app/AppName-iOS.debug.dylib' (code signature not valid for use in process: Trying to load an unsigned library), 
          '/path/to/DerivedData/PackageFrameworks/AppName-iOS.debug.dylib' (no such file), 
          '/path/to/AppName-iOS.app/Frameworks/AppName-iOS.debug.dylib' (no such file),
          '/path/to/CoreSimulator/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/AppName-iOS.debug.dylib' (no such file)

For some reason the Library is unsigned and I've checked all the settings with no luck.

If you create a new test project from the iOS > App template, does it have the same problem?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you for your response. Yes a test project using the iOS > App template works alright.

Cool.

Was your main Xcode project created by some third-party tooling? Or was it originally with Xcode?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

No no, using Xcode. But a while ago, April 2019 to be exact.

OK.

Xcode 16 introduced a new setting, Enable Debug Dylib Support that puts all of your app code into a dynamic library, replacing the app executable with a trivial stub that loads and runs that library. It seems that the stub is unable to load the library for some reason.

As a diagnostic test, try disabling that setting. Does that help?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

You were absolutely right! Disabling ENABLE_DEBUG_DYLIB helps. What's the correct solution then?

Hello!

I had the same issue and I just figured the origin! My app entry point is in a package, so I have no swift file in my project (outside of the lib). I guess that's why AppName-iOS.debug.dylib doesn't exist.

I created an empty struct and now it works fine with Xcode 16.

I hope it helps,

Cédric

Code signature not valid when running on Simulator in Xcode 16
 
 
Q