Since upgrading to Xcode 10.2 I can no longer run react-native run-ios through the cli
I solved like this ;
Firstly, you need to go this path
node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
and then;
You need to change this code
if (!version.startsWith('iOS') && !version.startsWith('tvOS'))
with
if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS'))
I hope, it will be helpful,
ref : https://github.com/facebook/react-native/issues/21498#issuecomment-476621627
I thought I would add my solution here too, in hopes to help someone. I just upgraded to Mac OS Mojave and I also upgraded to Xcode 10.2. My whole react native project broke, real bad. So then I downgraded Xcode back to 10.1. Then, I started to see this error, in said after running react-native run-ios:
Could not find iPhone X simulator
the above "hack" fixed it by editing the findMatchingSimulator.js file with the updates above.
Then, react-native run-ios got farther, next error was:
:CFBundleIdentifier, does not exist
I fixed this by:
- cd node_modules/react-native/third-party/glog* TabEnter
- ./configure
Now react-native run-ios works . I hope this helps someone, this was a pain in the @ss.
This bug has been fixed since RN v0.58.0
, see commits here
IIRC this bug was introduced in Xcode 10.1
Also, you can fix this by simply replacing startsWith()
with includes()
. But doing this every time you update node_modules
is less than ideal so I would recommend updating your RN version if possible.