Backwards compatibility in findMatchingSimulator version input#23305
Backwards compatibility in findMatchingSimulator version input#23305osunnarvik wants to merge 2 commits intofacebook:0.58-stablefrom
Conversation
…ewest xcrun to list devices. Format of xcrun output has changed
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues.
| continue; | ||
| } | ||
| if (simulatorVersion && !version.endsWith(simulatorVersion)) { | ||
| let versionWithDashReplacedByDot = version.replace(/-/g,'\.') |
There was a problem hiding this comment.
prettier/prettier: Replace '\.') with ·'.');
| continue; | ||
| } | ||
| if (simulatorVersion && !version.endsWith(simulatorVersion)) { | ||
| let versionWithDashReplacedByDot = version.replace(/-/g,'\.') |
| } | ||
| if (simulatorVersion && !version.endsWith(simulatorVersion)) { | ||
| let versionWithDashReplacedByDot = version.replace(/-/g,'\.') | ||
| if (simulatorVersion && !versionWithDashReplacedByDot.endsWith(simulatorVersion)) { |
There was a problem hiding this comment.
prettier/prettier: Replace simulatorVersion·&&·!versionWithDashReplacedByDot.endsWith(simulatorVersion) with ⏎······simulatorVersion·&&⏎······!versionWithDashReplacedByDot.endsWith(simulatorVersion)⏎····
Generated by 🚫 dangerJS |
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues.
| continue; | ||
| } | ||
| if (simulatorVersion && !version.endsWith(simulatorVersion)) { | ||
| let versionWithDashReplacedByDot = version.replace(/-/g,'\.'); |
There was a problem hiding this comment.
prettier/prettier: Replace '\ with ·'
|
Thanks for making us aware of this issue. I noticed that we already had this fix in the newer version of the CLI that was extracted, so I decided to just backport that one and push it to the 0.58 branch. |
Summary
handling dot-version input in findMatchingSimulator also when using newest xcrun to list devices. Format of xcrun output has changed
When parsing simulator names in order to run on iOS simulator, the version provided by xcrun now is separated by a dash instead of a dot. Therefore when input to run-ios --simulator is specified with an iOS version (in dot-format), the simulator will not be found.
This started happening for me after I installed the latest XCode (beta). I am currently using XCode "Version 10.2 beta (10P82s)", but I have tried using xcode-select to point towards the latest stable XCode version as well, but the problem still occurs. My version of xcrun is "xcrun version 43.1."
Changelog
[iOS] [Changed] - Backwards compatibility in input format for run-ios --simulator "<device-type (device-version)>"
Test Plan
Run the command "react-native run-ios --simulator "iPhone X (12.2)". Without the fix I get the error
Could not find iPhone X simulator
With the fix, it starts fine (Assuming you have an iPhone X 12.2 simulator installed on your machine.)