I have just got my first MacBook and am trying to run a Flutter project using VSCode. The project runs fine on an Android Emulator but doesn't on iOS Simulator.
Here's the log:
Launching lib/main.dart on iPhone 16 Pro in debug mode...
Xcode build done. 8.9s
Failed to build iOS app
Uncategorized (Xcode): Command SwiftGeneratePch emitted errors but did not return a nonzero exit code to indicate failure
Error (Xcode): no such file or directory: '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
Error (Xcode): stat cache file '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.2-22C146-07b28473f605e47e75261259d3ef3b5a.sdkstatcache' not found
Error (Xcode): unable to rename temporary '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1QOPLZ3HJICL2/UIKit-1KHQ7M05IFVXC-026d8a9d.pcm.tmp' to output file '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1QOPLZ3HJICL2/UIKit-1KHQ7M05IFVXC.pcm': 'No such file or directory'
Error (Xcode): could not build module 'UIKit'
/Users/sm-sayedi/Projects/web/flutter/test_app/build/ios/Debug-iphonesimulator/Flutter.framework/Headers/FlutterAppDelegate.h:7:8
Error (Xcode): could not build module 'Flutter'
/Users/sm-sayedi/Projects/web/flutter/test_app/ios/Runner/GeneratedPluginRegistrant.h:9:8
Error (Xcode): failed to emit precompiled header '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/Runner-chzjlziqevvgrcgaoauskndbtofm/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_1OW9P6QJWPL3W-clang_1QOPLZ3HJICL2.pch' for bridging header '/Users/sm-sayedi/Projects/web/flutter/test_app/ios/Runner/Runner-Bridging-Header.h'
Uncategorized (Xcode): Command PrecompileSwiftBridgingHeader emitted errors but did not return a nonzero exit code to indicate failure
Swift Compiler Error (Xcode): No such file or directory: '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
Swift Compiler Error (Xcode): Stat cache file '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.2-22C146-07b28473f605e47e75261259d3ef3b5a.sdkstatcache' not found
Swift Compiler Error (Xcode): Clang importer creation failed
Uncategorized (Xcode): Command SwiftEmitModule failed with a nonzero exit code
Could not build the application for the simulator.
Error launching application on iPhone 16 Pro.
Exited (1).
I have just got my first MacBook and am trying to run a Flutter project using VSCode. The project runs fine on an Android Emulator but doesn't on iOS Simulator.
Here's the log:
Launching lib/main.dart on iPhone 16 Pro in debug mode...
Xcode build done. 8.9s
Failed to build iOS app
Uncategorized (Xcode): Command SwiftGeneratePch emitted errors but did not return a nonzero exit code to indicate failure
Error (Xcode): no such file or directory: '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
Error (Xcode): stat cache file '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.2-22C146-07b28473f605e47e75261259d3ef3b5a.sdkstatcache' not found
Error (Xcode): unable to rename temporary '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1QOPLZ3HJICL2/UIKit-1KHQ7M05IFVXC-026d8a9d.pcm.tmp' to output file '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1QOPLZ3HJICL2/UIKit-1KHQ7M05IFVXC.pcm': 'No such file or directory'
Error (Xcode): could not build module 'UIKit'
/Users/sm-sayedi/Projects/web/flutter/test_app/build/ios/Debug-iphonesimulator/Flutter.framework/Headers/FlutterAppDelegate.h:7:8
Error (Xcode): could not build module 'Flutter'
/Users/sm-sayedi/Projects/web/flutter/test_app/ios/Runner/GeneratedPluginRegistrant.h:9:8
Error (Xcode): failed to emit precompiled header '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/Runner-chzjlziqevvgrcgaoauskndbtofm/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_1OW9P6QJWPL3W-clang_1QOPLZ3HJICL2.pch' for bridging header '/Users/sm-sayedi/Projects/web/flutter/test_app/ios/Runner/Runner-Bridging-Header.h'
Uncategorized (Xcode): Command PrecompileSwiftBridgingHeader emitted errors but did not return a nonzero exit code to indicate failure
Swift Compiler Error (Xcode): No such file or directory: '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
Swift Compiler Error (Xcode): Stat cache file '/Users/sm-sayedi/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.2-22C146-07b28473f605e47e75261259d3ef3b5a.sdkstatcache' not found
Swift Compiler Error (Xcode): Clang importer creation failed
Uncategorized (Xcode): Command SwiftEmitModule failed with a nonzero exit code
Could not build the application for the simulator.
Error launching application on iPhone 16 Pro.
Exited (1).
Share
Improve this question
asked Mar 19 at 8:05
sm-sayedism-sayedi
95513 silver badges34 bronze badges
7
|
Show 2 more comments
1 Answer
Reset to default 0That solution is straightforward and effective for resolving Xcode build issues after an update. However, here are a few improvements to make the answer clearer and more professional:
Improved Answer:
I faced this issue after updating Xcode and iOS 16. Here’s what worked for me:
1. Open your project in Xcode.
2. Click on File in the top menu bar.
3. Select Workspace Settings.
4. Change Derived Data from Default Location to Workspace-relative Location.
5. Click Done.
6. Run your app again.
This resolved the issue for me. If the problem persists, try running flutter clean and rebuilding the project.
sudo gem install cocoapods
? By the way, I have followed the instructions in docs.flutter.dev/get-started/install/macos/mobile-ios. – sm-sayedi Commented Mar 19 at 8:09cd ios rm -rf Pods rm -rf Podfile.lock pod install cd ..
– Munsif Ali Commented Mar 19 at 8:12pod install
is run, it says:[!] No `Podfile' found in the project directory.
– sm-sayedi Commented Mar 19 at 8:55