1.react-native ListView的屬性flexWrap為wrap不起作用解決之道
2.React Native 0.32以下版本Xcode8報錯解決辦法
2.1 'RCTRootView.h' file not found
- cd到這個項目中,執(zhí)行
npm install react-native
- 此項目中還有其他依賴,執(zhí)行
npm install
,即可添加所有依賴
如果運行還有錯誤,請參考以下
2.2 RCTSRWEBSOCKET.M報錯
Ignoring return value of function declared with warn_unused_result attribute
這個報錯在此文件中有兩處,代碼
SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
修改為
(void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
2.3 RCTSCROLLVIEW.M 報錯
Use of undeclared identifier '_refreshControl'; did you mean 'refreshControl'?
@implementation RCTCustomScrollView { __weak UIView *_dockedHeaderView; RCTRefreshControl *_refreshControl; // 加入此行 }
重新打開項目運行
3.React Native iOS 之Could not connect to development server
將項目中的
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
改為本地IP
jsCodeLocation = [NSURL URLWithString:@"http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true"];
PS:127.0.0.1為本地的IP
reason:做本地局域網(wǎng)開發(fā)環(huán)境,大部分都會做服務(wù)器映射處理,localhost 被指向特定的IP 而不是本機的127.0.0.1, 就會出現(xiàn)這樣的問題。
4.項目開始運行報錯
原因一:
先前運行過其它的React-Native項目。
解決辦法:
退出終端程序,重新運行項目即可
原因二:
AppDelegate.m文件中
index.iOS.js文件中
兩個文件中MyProject字段設(shè)置不一樣。
解決辦法:
將字段設(shè)為一樣的字符即可。