升级Xcode 11之后无Error Could not find iPhone X simulator,node_modules/@react-native-community/cli-platfo

node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/findMatchingSimulator.js

网上的修改react-native/..文件都是错误的,因为重点在@react-native-community中.

解决办法1:直接在XCode中创建iPhone X模拟器:xcode中点击 Window > Devices and Simulators>点击加号+>Device type选择iPhone X > Create > 完成! 此时运行react-native run-ios 已经可以了!

升级Xcode 11之后无Error Could not find iPhone X simulator,node_modules/@react-native-community/cli-platfo_第1张图片

官方原文:

MANAGE DEVICES

Create a simulator configuration

If you don’t see the device type with the operating system version you want to test in Simulator, you can create a custom configuration using the Devices and Simulators window. The new simulator will appear in the run destination of the scheme menu in the toolbar.

  1. Open the Devices and Simulators window (choose Window > Devices and Simulators), then click Simulators.

  2. In the lower-left corner, click the Add button (+).

  3. In the sheet that appears, enter a simulator name, choose a device type, and choose an operating system version.

    升级Xcode 11之后无Error Could not find iPhone X simulator,node_modules/@react-native-community/cli-platfo_第2张图片

  4. If you don’t see the operating system version you want to use, choose “Download more simulator runtimes.”

    The Components preferences opens where you can download and install simulator runtimes.

  5. Click Create.

解决方法2:(下面一顿操作,没有实质卵用)手动打开模拟器:

然后

Hardware, Device, iOS 13.0.

将看到: - iPhone 8 - iPhone 8 Plus - iPhone XS - iPhone XS Max - iPhone XR - ...

选择某一个,比如最新的iPhone 11 Pro Max

然后执行命令:react-native run-ios --simulator="iPhone 11 Pro Max"

漫长的等待..OK!

如果还不行:接下来

node_modules/@react-native-community/cli/build/commands/runIOS/findMatchingSimulator.js修改该文件下的

  1. if (

  2. simulator.availability !== '(available)' &&

  3. simulator.isAvailable !== 'YES'

  4. ) {

  5. continue;

  6. }
  7. 将'YES'改为true即可 如:
  1. if (

  2. simulator.availability !== '(available)' &&

  3. simulator.isAvailable !== true

  4. ) {

  5. continue;

你可能感兴趣的:(React-Native)