react-native: Error: Could not find iPhone 6 simulator

I got this error when i ran: react-native run-ios

Could not find iPhone 6 simulator

Error: Could not find iPhone 6 simulator
    at resolve (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
    at new Promise (<anonymous>)
    at runOnSimulator (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at Promise.resolve.then (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/cliEntry.js:117:22)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 34 (4 by maintainers)

Commits related to this issue

Most upvoted comments

In case anybody else stumbles here, my solution was different.

What fixed it for me was manually updating our node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js from

if (!version.startsWith('iOS') && !version.startsWith('tvOS'))

to

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

If you console.log(version), each is now prefixed with com.apple.CoreSimulator.SimRuntime.


Also looks like

simulator.isAvailable !== 'YES'

should now be

if (simulator.isAvailable !== true)

And for anybody now getting: Nullability Issue Pointer is missing a nullability type specifier

I’ve created a gist that fixes RCTLinkingManager.h here: https://gist.github.com/leotm/05e34468f25c29623a731692738e140e

And finally get a successful build with XCode 10.2 (10E125) \o/

it works for me:

    if (!version.startsWith('iOS') && !version.startsWith('tvOS')) 

to

if (
      !version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS-12-2') &&
      !version.startsWith('tvOS')
    ) 

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

After upgrading to Xcode 10.2 this needs to be done if you are still using RN 0.53

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

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

To make patrickgodinho’s fix more automatic, add

"scripts": {
  "postinstall": "sed -i '' \"s/version.startsWith('iOS')/version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS')/g\" ./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js"
}

to your package.json.

When you or a coworker runs npm install, the bug will go away.

This error is occurring because the response of “xcrun simctl list --json devices” got changed. “availability” is changed by “isAvailable” Workaround : Open file findMatchingSimulator.js --> Replace simulator.availability !== ‘(available)’ with simulator.isAvailable !== ‘YES’

In addition to what @leotm said,

I’ve found that some simulator names have changed in Xcode 10.2 (iOS 12.2 SDK), iPhone XS becomes iPhone Xs iPhone XS Max becomes iPhone Xs Max iPhone XR becomes iPhone Xʀ

So instead of running,

react-native run-ios --simulator "iPhone XS Max"

You should run

react-native run-ios --simulator "iPhone Xs Max"

In case anybody else stumbles here, my solution was different.

What fixed it for me was manually updating our node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js from

if (!version.startsWith('iOS') && !version.startsWith('tvOS'))

to

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

If you console.log(version), each is now prefixed with com.apple.CoreSimulator.SimRuntime.

Also looks like

simulator.isAvailable !== 'YES'

should now be

if (simulator.isAvailable !== true)

And for anybody now getting: Nullability Issue Pointer is missing a nullability type specifier

I’ve created a gist that fixes RCTLinkingManager.h here: https://gist.github.com/leotm/05e34468f25c29623a731692738e140e

And finally get a successful build with XCode 10.2 (10E125) \o/

Thanks. It worked for me.

i upgraded my react-native version to latest (last week) - and this seems to have been fixed in newer versions. Trying to run the script proposed by @mcjohnalds on this version, yields an error that its unable to locate the text it wants to replace.

    "react": "16.8.3",
    "react-native": "^0.59.4",

@leotm - do you have any idea when or how this will be fixed in react-native? It seems that it will now affect everyone. I’m currently on 0.57.8, and experiencing this issue, but looks like even if you are on the latest version you still get this.

Updating the file in node_modules is not a good solution these are temporary files.

To make patrickgodinho’s fix more automatic, add

"scripts": {
  "postinstall": "sed -i '' \"s/version.startsWith('iOS')/version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS')/g\" ./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js"
}

to your package.json.

When you or a coworker runs npm install, the bug will go away.

for anyone who looking for the solution about old version React Native project that runs failed on the newest XCode, please just using this as a workaround.

thank you for just saving my day :p

Really shouldn’t be updating the code contained in node_modules if you can avoid it. Anyone who doesn’t have that fix will run into the same issue and any updates to the packages you edit will reverse the “fix”.

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you’d like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.