You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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 -showsdks to 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 .xcodeproj directly if you use CocoaPods. Navigate to your project’s ios folder and open [YourProjectName].xcworkspace instead—this includes all pod dependencies.
  • Reinstall pods if needed: If the workspace looks empty or broken, clean up and reinstall pods:
    cd ios
    pod deintegrate
    rm Podfile.lock
    pod install
    
    Then re-open the .xcworkspace file.
  • Configure Xcode for the simulator: In Xcode, go to Product > Destination and select a valid simulator. Clean the build folder with Shift + Cmd + K, then build the project with Cmd + 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 & Capabilities tab. 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:
    npm start -- --reset-cache
    
    Then try react-native run-ios again.
  • Verify build settings: In Xcode’s Build Settings for your target, confirm:
    • Deployment Target matches the iOS version of your simulator
    • Architectures is set to Standard 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.json matches the folder names in the ios directory.
  • After major changes (like regenerating the iOS folder), always restart your Metro bundler and Xcode to avoid state-related glitches.

内容的提问来源于stack exchange,提问作者Camille Basbous

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 07:47:32