I updated to Xcode 10 and since I did that, I can't run the simulator in terminal with the command react-native run-ios
. I get this error:
Could not find iPhone 6 simulator
When I go to Xcode > Window > Devices and Simulator the simulator is there and when I do xcrun simctl list devices
I also see the list of simulator.
I can run the app on my phone with react-native run-ios --device
and from Xcode, and I tried with multiple apps so it's not the app.
When I go to Xcode > Preferences > Locations, Xcode 10.0 (10A255) is selected at Command Line Tools.
I tried restarting the computer, as well as deleting and re-installing Xcode.
Any ideas what it could be?
Here is my setup:
I went to node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
And i've replaced:
if (version.indexOf('iOS') !== 0 )
with
if (!version.includes("iOS" ))
And
if (simulator.availability !== '(available)')
with
if (simulator.isAvailable !== true)
I had similar issue. React Native - 0.52.3, XCode - 10.2 beta 2
function findMatchingSimulator(simulators, simulatorName) {
if (!simulators.devices) {
return null;
}
const devices = simulators.devices;
var match;
for (let version in devices) {
// Making sure the version of the simulator is an iOS (Removes Apple Watch, etc)
if (!version.includes('iOS')) {
continue;
}
[...]
}
}
Open file: node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
Check if your device version is correct, e.g: in line 29 console.log(version)
Compare it with condition in line 30: if (version.indexOf('iOS') !== 0) {
I had versions list like this:
com.apple.CoreSimulator.SimRuntime.watchOS-5-0 -1
com.apple.CoreSimulator.SimRuntime.tvOS-12-1 -1
com.apple.CoreSimulator.SimRuntime.tvOS-12-2 -1
Any of my versions doesn't return true in this condition... If you have it
version.indexOf('iOS') !== 0
with !version.includes('iOS')
and it solve this issue for me.The bug has been fixed in react-native
so you can update the package in the package.json:
npm install -g npm-check-updates
ncu -u react-native
npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With