React Native项目无法在iOS模拟器/Xcode中显示的修复求助
Fixing React Native iOS Integration Issues After Regenerating iOS Folder
Let's break down your problems step by step and get your project running smoothly in Xcode, the simulator, and both terminals again.
1. Resolve the xcrun instruments Error in Regular Terminal
That error pops up for two key reasons: the instruments tool was deprecated in newer Xcode versions, and your system is trying to access a missing SDK path (iPhoneSimulator12.1.sdk doesn’t exist in your current Xcode installation). Here’s how to fix it:
- Set the correct Command Line Tools path: Open Xcode, go to
Xcode > Preferences > Locations, then under "Command Line Tools", select the version of Xcode you currently have installed (not an old, uninstalled one). - Reset your xcrun path: Run this command to ensure it points to the right Xcode instance:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer - Verify available SDKs: Run
xcodebuild -showsdksto see which iOS simulator SDKs are supported. If your React Native project targets an old SDK (like 12.1), update your project’s deployment target in Xcode to match a supported version, or upgrade React Native to be compatible with your current Xcode.
2. Get Your Project Showing in Xcode and Simulator
You regenerated the iOS folder, but it’s not appearing? Let’s make sure you’re using the right files and resolving pod dependencies:
- Open the correct workspace file: Never open the
.xcodeprojdirectly if you use CocoaPods. Navigate to your project’siosfolder and open[YourProjectName].xcworkspaceinstead—this includes all pod dependencies. - Reinstall pods if needed: If the workspace looks empty or broken, clean up and reinstall pods:
Then re-open thecd ios pod deintegrate rm Podfile.lock pod install.xcworkspacefile. - Configure Xcode for the simulator: In Xcode, go to
Product > Destinationand select a valid simulator. Clean the build folder withShift + Cmd + K, then build the project withCmd + B—this should make your project appear in the simulator.
3. Fix the xcodebuild error code 65 in VS Code Terminal
Error 65 is a generic build failure, but it usually ties back to signing, dependencies, or cache issues. Try these fixes:
- Check signing configuration: In Xcode, go to your project target’s
Signing & Capabilitiestab. Enable "Automatically manage signing", select your developer team, and ensure your Bundle Identifier is unique (no other app uses it). - Clear React Native cache: Stale cache can cause build issues. Run this in your project root:
Then trynpm start -- --reset-cachereact-native run-iosagain. - Verify build settings: In Xcode’s
Build Settingsfor your target, confirm:Deployment Targetmatches the iOS version of your simulatorArchitecturesis set toStandard Architectures (arm64, x86_64)- No red flags or missing dependencies in the project navigator
Extra Tips
- If you renamed your project at any point, double-check that the project name in
package.jsonmatches the folder names in theiosdirectory. - After major changes (like regenerating the iOS folder), always restart your Metro bundler and Xcode to avoid state-related glitches.
内容的提问来源于stack exchange,提问作者Camille Basbous
相关产品推荐
相关产品推荐

