Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-native Xcode build fails -> 'RCTAssert.h file not found'

Tags:

react-native

I did exactly the steps which are described here in the React-native getting started guide:

https://facebook.github.io/react-native/docs/getting-started.html

When I open the Project and build it, the build fails:

RCTAssert.h file not found' in MyProjectNameTests.m .

What am I missing?

Here are the steps from the getting started guide:

Requirements

OS X - This repo only contains the iOS (7+) implementation right now, and Xcode only runs on Mac.

Xcode 6.3 or higher is recommended.

Homebrew is the recommended way to install io.js, watchman, and flow.

Install io.js 1.0 or newer. io.js is the modern version of Node.

Install nvm with its setup instructions here. Then run nvm install iojs-v2 && nvm alias default iojs-v2, which installs the latest compatible version of io.js and sets up your terminal so that typing node runs io.js. With nvm you can install multiple versions of Node and io.js and easily switch between them.

New to npm?

brew install watchman. We recommend installing watchman, otherwise you might hit a node file watching bug.

brew install flow. If you want to use flow. We recommend periodically running brew update && brew upgrade to keep your programs up-to-date.


Quick Start

npm install -g react-native-cli

react-native init AwesomeProject

In the newly created folder AwesomeProject/

Open AwesomeProject. xcodeproj and hit run in Xcode. Open index.ios.js in your text editor of choice and edit some lines. Hit cmd+R in your iOS simulator to reload the app and see your change!

like image 772
Daniel Alexander Benesch Avatar asked Aug 27 '15 13:08

Daniel Alexander Benesch


4 Answers

The test application can't find the header because it's not in the header search path.

In the left hand file list, hit the top left "folder" icon, then select your application at top left. In this case "AwesomeProject".

To the right of that, where the application icon appears, hold down to change to AwesomeProjectTests.

On the right side, click on the 'Build settings' tab.

Then scroll down to Header Search Paths and change "$(SRCROOT)/node_modules/react-native/React" to "$(SRCROOT)/../node_modules/react-native/React".

The app should now compile.

like image 54
stef Avatar answered Nov 12 '22 09:11

stef


I got the same issue as daniel but I already have the right path in xcode ...

0.10.0 is my version

like image 2
rasmus1610 Avatar answered Nov 12 '22 10:11

rasmus1610


It's an issue in 0.10.0, and it has been fixed just now.

You need to re-generate your project. Refer to this PR: https://github.com/facebook/react-native/pull/2474

like image 2
wosuopu Avatar answered Nov 12 '22 11:11

wosuopu


seeing same issue here and it seems react-native is latest on 0.10.0, i was using 0.8.0 and was running fine. May be to disable the test target for now?

like image 1
Gaurav18ca Avatar answered Nov 12 '22 09:11

Gaurav18ca