在使用React-Native开发应用前需要有一些移动端的开发经验,不然遇到的问题够你喝一壶的。而且是Android和IOS两边的问题。

  1. IOS 运行报错 ‘boost/iterator/iterator_adaptor.hpp’ file not found’ 及控制台”:CFBundleIdentifier”, Does Not Exist

原因:boost依赖没有找打,到当前用户目录下的.rncahe目录下查找boost_1_63_0.tar.gz文件,如果存在查看是否能够正常解压如果不能,需要手动到网上下载该包
下载地址Boot_1_63_0然后放入.rncache文件夹中。

  1. IOS config.h file not found

根据这个issue 找到解决方法

1
$ rm -rf node_modules/ && yarn cache clean && yarn install

重新安装依赖项目

最好分别用Android Studio 和Xcode工具能够把两个项目先运行起来。在开发工具中运行成功后,用react-native的命令会简单很多。然后遇到问题解决问题。

  1. android 项目第一次 打开很慢的问题。
    第一次打开需要下载gradle相关的包。可以去gradle官网先手动下载下来,然后将gradle环境在本机运行好之后再打开android项目。

4 Start Systrace 之后报错 global.nativeTraceBeginSection is not a function

根据官方人员的回答:

I’m aware of this issue. We currently don’t have these methods on the C++ bridge since the C++ implementation depends on fbsystrace, which is not open-source. As a workaround, you can revert back to RCTBatchedBridge (ReactLegacy), we’ll try to find a solution for this soon.

暂时还没解决。所以先不要用Systrace。不然报错之后只能重新跑模拟器。