报错代码:
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 (<anonymous>)
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;
}