react native:运行react-native run-ios报错Error: Could not find iPhone X simulator解决办法

报错代码:

Found Xcode project ****.xcodeproj

Could not find iPhone X simulator

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

解决方案:
打开文件: /node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
更改以下代码:

if (!version.startsWith('iOS') && !version.startsWith('tvOS')) {
  continue;
}

改为

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

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