react native 指定iphone模拟器型号运行

Step 1: Open the file

/node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

Step 2: Change a line of code, from this:

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

to this:

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

Step 3:
after update to Xcode 11 xcrun returns true or false and not YES or NO as before.

goto

/node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js 

find

if (
   simulator.availability !== '(available)' &&
   simulator.isAvailable !== 'YES'
 ) {
  continue;
}

and change it to

if (
   simulator.availability !== '(available)' &&
   simulator.isAvailable !== true
 ) {
  continue;
}

react-native run-ios --simulator="iPhone 11"

你可能感兴趣的:(react native 指定iphone模拟器型号运行)