欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

react-nativ在找不到模拟器 Could not find iPhone X simulator

程序员文章站 2022-06-15 22:46:45
...
test git:(develop) ✗ react-native run-ios 
Found Xcode project OKWallet.xcodeproj

Could not find iPhone X simulator

Error: Could not find iPhone X simulator
    at resolve (/Users/u1/test/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
    at Promise (<anonymous>)
    at runOnSimulator (/Users/u1/test/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/u1/test/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at Promise.resolve.then (/Users/u1/test/node_modules/react-native/local-cli/cliEntry.js:117:22)
    at <anonymous>

解决方法:

第一步:更改node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js 第42行

    if (
      !version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') &&
      !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS')
    ) {
      continue;
    }

第二步:更改node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js 第56行

if (!simulator.isAvailable) {
        continue;
      }

具体参考链接