在运行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

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐