在網(wǎng)絡(luò)上下載的reactNative源碼報(bào)錯(cuò)解決方案
報(bào)錯(cuò)內(nèi)容:
報(bào)錯(cuò)RCTRootView not found
RCTRootView 屬于react-native依賴中的類,你需要在工程目錄下,npm install react-native,如果你項(xiàng)目中有npm package文件,直接運(yùn)行npm install即可安裝配置文件中的依賴
如果確認(rèn)已經(jīng)依賴,則添加link:Link Binary with Library-->Add Other -->node_modules ->react-native -> React -> Base -> RCTRootView.m

報(bào)錯(cuò):

處理方式和上面一樣
報(bào)錯(cuò)信息提示RCTSRWebSocket.m報(bào)錯(cuò),Ignoring return value of function declared with warn_unused_result attribute
RCTSRWebSocket.m報(bào)錯(cuò),需要在報(bào)錯(cuò)的錯(cuò)誤處SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t*)mask_key)做處理,只需在該處加上(void)即可。如下:(void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
RCTSRWebSocket.m 共有兩處涉及,請(qǐng)確保都要修改。
只處理 RCTSRWebSocket.m還是不行。還需要在RCTScrollView.m 做出修改
@implementation RCTCustomScrollView
{
__weak UIView *_dockedHeaderView;
RCTRefreshControl *_refreshControl; //加入此行
}
不然會(huì)報(bào) Use of undeclared identifier '_refreshControl'; did you mean 'refreshControl'?錯(cuò)誤,RCTScrollView.m 位于Xcode項(xiàng)目中l(wèi)ibraries下React.xcodeproj / React / View 中
當(dāng)然如果你的react-ntive 版本在0.32.0以上,這些都不用處理。react-native 0.32.0以下版本可按此方法處理。
報(bào)錯(cuò): Application XXX has not been registered. This is either due to a require() error during initialization or failure to call AppRegistry.registerComponent.
首先,通過(guò)命令:ps aux | grep react-native 查看正在運(yùn)行的進(jìn)程,然后,找到launchPackager.command進(jìn)程,再使用命令:kill加進(jìn)程id 來(lái)結(jié)束該進(jìn)程。