20

I have a react native project running on react native version 0.59.8 , and xcode version 10.3. Somehow my xcode got updated to version 11.0 and after that i am unable to build the project using react-native run-ios command.

I have tried cleaning up the build and building again. But that doesn't help.

I am getting the following error:

CoreData: annotation:  Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
error Could not find iPhone X simulator.

How to fix this issue?

Ganesh Krishna
  • 714
  • 1
  • 7
  • 13

9 Answers9

6

Not sure about the first error, but I have same problem for second error error Could not find iPhone X simulatorafter upgrade to XCode 11

Basically I changed the line 53 in the react native project /node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js, from simulator.isAvailable !== 'YES' to simulator.isAvailable !== true.

The root cause is new XCode 11 changed the simulator metadata format, and react native findMatchingSimulator method is strongly coupled to the previous format.

Alex Bin Zhao
  • 398
  • 3
  • 11
5

I was able to fix the "Could not find iPhone X simulator" error.

These are the steps to fix the above error:

Run the command find . -iname findMatchingSimulator.js to locate findMatchingSimulator.js file.

In this file, Change the code from

if (simulator.availability !== '(available)' && simulator.isAvailable !== 'YES') {
        continue;
      }

to

if (simulator.availability !== '(available)' && simulator.isAvailable !== true) {
        continue;
      }

By doing this simulator error is resolved. But Still the other error

CoreData: annotation:  Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'

exists, which makes the build to fail. If I install xcode 10.3 and run the command react-native run-ios, it still works. Hope the issue is clear. Any fixes for this issue which occurs in xcode 11?

Ganesh Krishna
  • 714
  • 1
  • 7
  • 13
4

Two things:

  • With Xcode 11, make sure you're using react-native-community/cli version 1.9.8 minimum, as it integrates the fix for Xcode 11 simulators new metadata format:

    https://github.com/react-native-community/cli/releases/tag/v1.9.8

  • Also, the iPhone X simulator is no longer available at least on my end. You can use an iPhone 11 instead :

react-native run-ios --simulator='iPhone 11'
3

In my case:

react: 16.8.3
react-native: 0.59.9
Xcode: 11.0
  1. Add iPhone X simulator: Open Xcode => Window => Devices and Simulators => Simulators => Press Plus button at the bottom
  2. Install latest version of cocoapods: sudo gem install cocoapods
  3. Re-Install cocoapods in project: Open project folder => ios => delete Podfile.lock, Pods folder, build folder => cd ios && pod install
  4. react-native run-ios Done!
NYSamnang
  • 346
  • 2
  • 8
1

After upgrading my XCode to version 11, in XCode simulators list it only shows ios 13 simulators as available, so we need to add previous version simulators, to do so, in XCode go to preferences -> Components -> and download and install a previous version ios simulator (ios 11.0 in my case), after doing so it must show other simulators in available simulator list. Clear all cache and re-run the react-native run-ios command and it should work now.

1

Try run specifying simulator version.

react-native run-ios --simulator="iPhone 11 Pro Max"
0

I upgraded "react-native" to "^0.61.1" and it worked for me

Metehan Senol
  • 651
  • 4
  • 10
0

I was having this same issue, and even went back to xCode 10.3....and still had the same issue. Then I came across this https://github.com/react-native-community/cli/pull/414 . Sounded to me like maybe they had fixed the issue and that I was running with an old version of the CLI. Proceeded to delete the entry in my lock file and run npm install. Working now. CLI is up to 1.11.2 https://github.com/react-native-community/cli

0

Run can run xcrun simctl list devices in a terminal to make sure you have the iPhone X simulator installed. If you can't see it in the list you need to add it to Xcode through Window -> Devices and Simulators -> Simulators (click the + in the bottom left)

Roosma
  • 1