My SwiftUI project failed to run when upgrading from Xcode 14.0 to Xcode 16.3

Build succeed,but app startup failed.

error info about dyld[1669]: Symbol not found

Please don't post screenshots of text errors. They aren't searchable, so if someone else has this same error they won't get to this page where we might have a solution... Okay?

Now, what have you tried?

Have you updated your project's settings? Xcode will recommend you update them when you load the project.

Have you cleaned the project? Deleted DerivedData, etc.?

The error message contains sensitive words and cannot be submitted.

Xcode didn't remind me to update the settings.

Here are a few solutions that I tried but none of them worked.

Corrupted Build Cache / Derived Data (Very Common): Stale or inconsistent files from previous builds, especially after Xcode upgrades, can cause linker errors.

Solution: Perform a thorough clean: In Xcode: Product > Clean Build Folder (or Shift+Cmd+K). Crucially: Delete Derived Data. Quit Xcode. Go to Xcode > Settings (or Preferences) > Locations. Click the small arrow next to the "Derived Data" path to open it in Finder. Delete the entire Derived Data folder (or at least the subfolder corresponding to your project). Restart Xcode and your iOS device. If using CocoaPods, navigate to your project directory in Terminal and run pod install again after deleting Derived Data. Try building and running again.

Inconsistent Build Settings: Mismatches in build settings between your project, the main app target, and the target that produces yituart.debug.dylib (if it's separate) are frequent culprits.

Solution: Verify consistency for all relevant targets (Project, App Target, yituart.debug.dylib target) and all configurations (Debug/Release): iOS Deployment Target: Ensure it's consistently 15.0 or lower everywhere. C++ Language Dialect: Ensure it's identically set to GNU++20 everywhere. Any mismatch (e.g., one target using C++14, another

C++20) can cause linking errors. C++ Standard Library: Ensure it's set to libc++ everywhere. C++20 Dialect vs. Deployment Target: Using a newer standard like C++20 while targeting an older OS like iOS 15 can sometimes lead to build/link issues, even if the runtime OS (iOS 17) supports it well. The build process might create fragile links based on the older target SDK.

Solution (Diagnostic Step): Temporarily change the C++ Language Dialect from GNU++20 to a more widely compatible standard like GNU++17 or GNU++14 across all relevant targets and configurations. Perform the thorough clean again (Clean Build Folder + Delete Derived Data). Rebuild and run. If the error disappears, it points to an incompatibility related to using C++20 features while targeting iOS 15. If the error persists, C++20 itself is less likely the direct cause.

Dependency Issues (CocoaPods, etc.): Problems with how third-party libraries (Pods) are integrated or built.

Solution: Ensure Pods are correctly installed. A clean reinstall might help: Close Xcode. In Terminal (in project directory): pod deintegrate rm Podfile.lock rm -rf Pods/ rm -rf *.xcworkspace pod install Delete Derived Data again. Reopen the .xcworkspace file in Xcode and try building.

Thank you. It worked after downgrading Xcode to 16.2.

Others' suggestions are as follows "I had the same problem, I could only solve it by removing the -Objc flag from Other Linker Flags, which some cocoapods packages insert because it depends on libs .a, this flag causes it to import unused codes that cause this error to happen, with me the problem is with Google Mobile Ads that inserts this flag, but the curious thing is that this problem only happens with iOS devices that have iOS versions below 18.4, the iPhone 15 with 18.4 the problem does not happen, now with all devices with 18.3, 18.2 and even 15.2 the application does not open.

Now the million dollar question, is the problem with Xcode or with third party libs that still depend on the -Objc flag?" [https://stackoverflow.com/questions/79573379/after-upgrading-from-xcode-14-0-to-xcode-16-3-my-swiftui-project-failed-to-run?noredirect=1#comment140333399_79573379)

My SwiftUI project failed to run when upgrading from Xcode 14.0 to Xcode 16.3
 
 
Q