在运行react native app时,运行react-native run-ios报错:

Could not find iPhone 6 simulator

解决办法1:(我的本地是通过这个办法弄好的)

  • 查看版本:xcrun simctl list --json devices
  • 运行你有的版本:react-native run-ios --simulator ‘iPhone 6s’

解决办法2:

  • 找到文件:node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
  • 修改两处地方如下:
/* if (version.indexOf('iOS') !== 0) {
   continue;
 }*/
 if (!version.includes('iOS') && !version.startsWith('tvOS')) {
   continue;
 }
/* if (simulator.availability !== '(available)') {
  continue;
}*/
 if (simulator.availability !== '(available)' &&
    simulator.isAvailable !== true) {
  continue;
}
  • 最后在运行:react-native run-ios --simulator 'iPhone 你自己的有的版本'

如果还没有解决的话,可以去这里找答案,国外友人提供了更多解决方案,可以多尝试下

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐