升级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 已经可以了!

官方原文:

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.

  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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值