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

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;
      }

具體參考鏈接

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章