React-Native Run-iOS Can Not Find Any Simulator

`react-native run-ios` returns Error: Could not find iPhone X simulator

Edited:
I copied your devices section of your output JSON and embedded to my own /node_modules/react-native/local-cli/runIOS/runIOS.js

function runOnSimulator(xcodeProject, args, scheme) {
return new Promise(resolve => {
try {
var simulators = {devices section of your json}; //Here
} catch (e) {
console.log("e", e);
throw new Error('Could not parse the simulator list output');
}

const selectedSimulator = findMatchingSimulator(simulators, args.simulator);
console.log("selected", selectedSimulator);
if (!selectedSimulator) {
throw new Error(`Could not find ${args.simulator} simulator`);
}
...

And finally, it gave the same error as yours. So I figured out that parsing version of devices different. In your devices, version is;

"com.apple.CoreSimulator.SimRuntime.tvOS-12-1" //for tvOS
"com.apple.CoreSimulator.SimRuntime.iOS-12-1" // for iOS

but in react-native checks this version values like this(/node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js);

// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
if (!version.startsWith('iOS') && !version.startsWith('tvOS')) {
continue;
}

So react-native can not recognize.

If we change this code with this;

// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS')) {
continue;
}

the problem was solved. I checked that with your JSON data in my computer and it worked.

react-native run-ios can not find any simulator

I've found a temporary fix:

In the following file:

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

...change line 42 to:

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

React native run-ios ignoring simulator option

What you can do just open the workspace from the ios folder of your app and try to run the application from there as there you have lots of options available to run it. Moreover you have clear understanding of bugs from there.

I hope this helps...Thanks :)

Could not find iPhone 6(or any other) simulator React-Native, nothing helps?

Change this line:

if (version.indexOf('iOS') !== 0) {

to this:

if (version.indexOf('com.apple.CoreSimulator.SimRuntime.iOS') !== 0) {

There was a recent change to xcode, and the simulator names are now prefixed. This solved it for me.



Related Topics



Leave a reply



Submit