下载reactNative项目源码报错解决方案

在网络上下载的reactNative源码报错解决方案
报错内容:

报错RCTRootView not found

RCTRootView 属于react-native依赖中的类,你需要在工程目录下,npm install react-native,如果你项目中有npm package文件,直接运行npm install即可安装配置文件中的依赖
如果确认已经依赖,则添加link:Link Binary with Library-->Add Other -->node_modules ->react-native -> React -> Base -> RCTRootView.m

屏幕快照_2017-05-03_上午11_04_18.png

报错:

屏幕快照 2017-05-03 上午10.57.22.png

处理方式和上面一样

报错信息提示RCTSRWebSocket.m报错,Ignoring return value of function declared with warn_unused_result attribute

RCTSRWebSocket.m报错,需要在报错的错误处SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t*)mask_key)做处理,只需在该处加上(void)即可。如下:(void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
RCTSRWebSocket.m 共有两处涉及,请确保都要修改。

只处理 RCTSRWebSocket.m还是不行。还需要在RCTScrollView.m 做出修改

@implementation RCTCustomScrollView

{

__weak UIView *_dockedHeaderView;

RCTRefreshControl *_refreshControl; //加入此行

}

不然会报 Use of undeclared identifier '_refreshControl'; did you mean 'refreshControl'?错误,RCTScrollView.m 位于Xcode项目中libraries下React.xcodeproj / React / View 中

当然如果你的react-ntive 版本在0.32.0以上,这些都不用处理。react-native 0.32.0以下版本可按此方法处理。

报错: Application XXX has not been registered. This is either due to a require() error during initialization or failure to call AppRegistry.registerComponent.
首先,通过命令:ps aux | grep react-native 查看正在运行的进程,然后,找到launchPackager.command进程,再使用命令:kill加进程id 来结束该进程。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容