Running application on 17.4 Simulator from Xcode 16.0 beta is crashing due to missing SwiftUICore.framework

Hi,

I have a project that is pretty complex and includes mostly UIKit/Swift code with some SwiftUI added on top. I also have some SPM modules and internal Cocoapods libraries linking in.

The project builds fine with the latest release version of Xcode (15) and runs on 17.4 simulator.

WIth Xcode 16.0 Beta however, the project builds and runs fine on iOS 18 simulators, however there is a specific crash that happens at startup on iOS 17.4 simulators. Please see crash log below with the name of my application redacted:

dyld[91294]: Library not loaded: /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore
  Referenced from: <14C085D7-ECA8-3287-8038-5DE320ADCEBD> /Users/xxxxxx/Library/Developer/CoreSimulator/Devices/C23AA8A9-8475-4EE2-86B3-136A0EBCC362/data/Containers/Bundle/Application/95A49FCF-A7E3-4A8B-93F1-C4CDDBA74B60/xxxxxx.app/Frameworks/SwiftUI_Common.framework/SwiftUI_Common
  Reason: tried: '/Users/xxxxxx/Library/Developer/Xcode/DerivedData/xxxxxx-fglltpkbphqqjzgdgdadysinonmq/Build/Products/Debug-iphonesimulator/SwiftUICore.framework/SwiftUICore' (no such file), '/Users/xxxxxx/Library/Developer/Xcode/DerivedData/xxxxxx-fglltpkbphqqjzgdgdadysinonmq/Build/Products/Debug-iphonesimulator/PackageFrameworks/SwiftUICore.framework/SwiftUICore' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file), '/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file, not in dyld cache), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file)

It seems like for some reason Xcode is building the app thinking there would be a SwiftUICore.framework on device, but since this framework is new in iOS 18 and does not exist on iOS 17.4, the system is unable to find it and crashes.

I have the min deployment target set to iOS 14.5, so I'm not sure why Xcode would make the assumption that SwiftUICore.framework will be available for linking on runtime.

Interestingly, I cannot reproduce this same issue on a clean project created using Xcode 16 and targeting min deployment of iOS 15.

I was wondering if anyone has any suggestions regarding specific build settings to check and see where the issue might be coming from.

Thanks

Hi zer0X,

We ran into a similar issue (with the same crash log). We found that the source of the problem, in our case, was the use of an UIViewControllerRepresentable implementation in a module. Moving the code to the main app source tree "solved" the issue for us. Of course, this is not acceptable in terms of code isolation, but this workaround will do for now...

Would you happen to use this protocol in a child module too?

Regards

Hello again zer0X,

Like you, the module name causing the crash on our side had an underscore in it. Renaming the module by simply removing the underscore fixed the issue for us.

Regards

My team had this same issue. We had several modules that needed to be renamed in order to fix the runtime "library not found" error with Xcode 16.

In my case we had 3 modules with the following names:

  • UIKit_Core
  • SwiftUI_Core
  • UI_Charts

Then we renamed these modules to:

  • CoreUIKit
  • CoreSwiftUI
  • ChartsUI

And now our app runs on iOS 17. 🤦‍♂️

@tbaigner thanks for the clues about underscores to help us get there.

Unfortunately the underscore workaround mentioned by tbaigner and GravityBytes did not apply to my case of this bug. I had to add -weak_framework SwiftUICore to the Other Linker Flags (OTHER_LDFLAGS) section of the Build Settings tab of my app target.

I am also using Capacitor for reference. See here for my formal bug report to Capacitor.

Hope this helps someone:)

In my case the cause was the name of the app target. It was just App. Renaming it fixed the issue so it's apparently some name collisions. The symptom itself was interesting: the app was crashing when .zIndex(1) modifier was used. I guess it might be not only one modifier that can cause this though.

The issue is reproduced on any modular project that has a Framework that uses Swift UI. I could reproduce it on a fresh project. Filed a feedback ticket.

So we have the same issue. Xcode 16.0, app works well on iOS 18 and iOS 16. IT's crashing for iOS 17.* In our case it was UI.framework that after renaming to CoreUI it works fine. So it looks like both SwiftUI and UI cannot be a prefix for the framework.

BTW: Two years ago we have similar issue with having Settings.framework in the project.

Running application on 17.4 Simulator from Xcode 16.0 beta is crashing due to missing SwiftUICore.framework
 
 
Q