React Native - Could Not Find 'iPhone X' Error
10 Oct 2019Environments | Version |
---|---|
react-native | 0.60.4 |
Xcode | 11.1 |
After updating Xcode to Version 11.1 (11A1027) I encountered ‘iPhone X’ not found error when running react-native run-ios
.
$ react-native run-ios
> error Could not find "iPhone X" simulator. Run CLI with --verbose flag for more details.
It’s mainly because new Xcode version does not have ‘iPhone X’ anymore. Actually iPhone model name has been slightly changed. ‘iPhone Xs’ Became ‘iPhone 11 Pro’. Some of other recent models has simmilar changes.
Possible Solutions
Specifying Device
When running react-native run-ios
command, you can specify device that exists.
react-native run-ios --simulator="iPhone 11 Pro"
It is the most simpleast solution, yet it’s quite annoying, since you have to type longer command.
Change Default Virtual Device
You can change default running virtual device in node_modules. Open up “/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js” in your text editor.
{
...
options: [{
name: '--simulator [string]',
description: 'Explicitly set simulator to use. Optionally include iOS version between' + 'parenthesis at the end to match an exact version: "iPhone 6 (10.0)"',
default: 'iPhone X'
},
...
]
}
See “default”? Just change it to something like “iPhone 11 Pro” or else.
The problem is, whenever you install node_modules again, it goes back to “iPhone X”.
Recommanded Solution
It is kind a tricky solution but easy and certain. Just add “iPhone X” to your Xcode. Press Button marked as in image above. Then, press plus button. Add “iPhone X”.