React Native iOS项目Xcode构建成功但模拟器无法启动求助
Fixing React Native iOS Simulator Not Launching from Xcode (Works via Terminal)
Hey there, let's skip the tedious Xcode reinstall for now—your Swift projects work perfectly, so Xcode itself is likely fine. Let's walk through targeted fixes to get your React Native app launching from Xcode:
1. Make Sure Xcode Command Line Tools Match Your Active Xcode Version
- Open Xcode, go to Preferences > Locations
- Under Command Line Tools, confirm the selected version matches the Xcode you're using (no old/beta builds left selected by mistake)
- Cross-check in terminal: Run
xcode-select -p—if the path doesn't match/Applications/Xcode.app/Contents/Developer, fix it with:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
2. Double-Check Your React Native Project's Xcode Setup
- Always open
.xcworkspacenot.xcodeproj: React Native relies on CocoaPods, so opening the raw project file can cause missing dependencies or runtime blocks - Verify your Scheme: Go to Product > Scheme > Manage Schemes, make sure your main app scheme is marked Shared and selected
- Switch simulators: Sometimes a specific simulator gets stuck in a broken state—try picking a different device (e.g., iPhone 14 instead of iPhone 15) from Xcode's top device selector
3. Dig Into Xcode's Hidden Run Logs
Build success doesn't guarantee runtime success. Head to the Report Navigator (left sidebar, 4th icon) to check the latest run attempt. Look for easy-to-miss errors like:
- Unconfigured permission requests (e.g., camera/photos access not added to Info.plist)
- Silent script execution failures (they might not break the build, but can block simulator launch)
4. Reset React Native Caches and Dependencies
- Clear Metro's cache first:
npx react-native start --reset-cache - Reinstall CocoaPods to fix dependency mismatches:
cd ios pod deintegrate pod install - Close Xcode completely, then reopen the
.xcworkspaceand try running again
5. Fix a Misbehaving Simulator
- Fully reset the simulator: Open Simulator → go to Device > Erase All Content and Settings..., then restart the simulator
- Delete and recreate broken simulators:
- Run
xcrun simctl list devicesin terminal to list all devices and their IDs - Delete any device marked "unavailable" or acting odd:
xcrun simctl delete <DEVICE_ID> - Create a new simulator via Xcode's Window > Devices and Simulators
- Run
6. Check React Native's Build Script Configuration
- Open your project in Xcode, navigate to Build Phases > Bundle React Native code and images
- Ensure the
NODE_BINARYpath is correct. If you use a node version manager (nvm, fnm), update the script to point to your active node path:
(Replace the existingexport NODE_BINARY=$(which node)export NODE_BINARY=nodeline)
If none of these work, reinstalling Xcode can be a last resort—but try reinstalling just the command line tools first with xcode-select --install before doing a full Xcode reinstall.
内容的提问来源于stack exchange,提问作者Silentboy
相关产品推荐
相关产品推荐

