美文网首页
react native 指定iphone模拟器型号运行

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

作者: next_discover | 来源:发表于2021-05-18 11:14 被阅读0次

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模拟器型号运行

      本文链接:https://www.haomeiwen.com/subject/whdhtktx.html