報(bào)錯(cuò)代碼:
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;
}