Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`react-native run-ios` command fails (PCH issues), but build succeeds in xcode

I had a react native project that was building and running perfectly fine. Then I decided to move it into a sub directory, and I started receiving lots of precompiled header errors:

PCH was compiled with module cache path '/Users/me/place1/ios/build/ModuleCache/3R9LOJFOBFZVJ', but the path is currently
  '/Users/me/place2/app/ios/build/ModuleCache/3R9LOJFOBFZVJ'

Fair enough, but what's weird is that, if I open up the xcode project and clean / rebuild in there, everything works!

Then when I close down the server started by xcode and try to launch it using react-native run-ios it continues to complain about PCH issues.

Not sure what I'm missing...

like image 656
WestleyArgentum Avatar asked Feb 24 '16 19:02

WestleyArgentum


People also ask

Can you run react native in Xcode?

If you are already familiar with mobile development, you may want to use React Native CLI. It requires Xcode or Android Studio to get started. If you already have one of these tools installed, you should be able to get up and running within a few minutes.

How do you remove iOS build in react native?

To clean the iOS build press Option+Shift+Command+K or go to Xcode menu Product -> Clean Build Folder.

What is build folder in iOS react native?

To summarize, ios/build folder contains final installation app files, auxiliary files and precompiled modules, various logs and source code index.


2 Answers

Sorry to answer my own, but turns out it's safe to just delete the whole build directory at /path/to/project/ios/build. After that it rebuilt fine for me :)

like image 72
WestleyArgentum Avatar answered Oct 15 '22 17:10

WestleyArgentum


No need to delete whole build directory but delete ModuleCache folder at /path/to/project/ios/build/ModuleCache and then react-native run-ios worked for me.

like image 16
NiRmaL Avatar answered Oct 15 '22 16:10

NiRmaL