我完全按照 React-native 入门指南中描述的步骤进行了操作:
https://facebook.github.io/react-native/docs/getting-started.html
当我打开项目并构建它时,构建失败:
RCTAssert.h file not found' in MyProjectNameTests.m .
我错过了什么?
以下是入门指南中的步骤:
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 runningbrew 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!
最佳答案
测试应用程序找不到 header ,因为它不在 header 搜索路径中。
在左侧文件列表中,点击左上角的“文件夹”图标,然后在左上角选择您的应用程序。在这种情况下,“AwesomeProject”。
在应用程序图标出现的右侧,按住以更改为 AwesomeProjectTests。
在右侧,单击“build设置”选项卡。
然后向下滚动到标题搜索路径并将“$(SRCROOT)/node_modules/react-native/React”更改为“$(SRCROOT)/../node_modules/react-native/React”。
该应用程序现在应该编译。
关于React-native Xcode 构建失败-> 'RCTAssert.h file not found',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32250172/