環(huán)境搭建
<a >官網(wǎng)</a>
<a >中文社區(qū)</a>
- <a >研究中的 github</a>
-
錯(cuò)誤0
###解決方法:手動(dòng)設(shè)置IP
- RCTBundleURLProvider在接口中暴露了jsLocation屬性,可以通過setJsLocation手動(dòng)設(shè)置IP。
<span>
```
NSURL *jsCodeLocation;
[[RCTBundleURLProvider sharedSettings] setDefaults];
#if DEBUG
[[RCTBundleURLProvider sharedSettings] setJsLocation:@"192.168.1.101"];
#endif
jsCodeLocation = [[RCTBundleURLProvider sharedSettings]
jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
</span>
<a >傳送門</a>
-
錯(cuò)誤1
2016-09-24 10:57:56.432 [warn][tid:main][RCTEventEmitter.m:54] Sending
websocketFailed
with no listeners registered.
2016-09-24 10:57:56.471 [info][tid:com.facebook.react.JavaScript] Running application "HelloWorld" with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF
解決方法:
本地服務(wù)器未啟動(dòng) sudo npm start
-
錯(cuò)誤2
2016-09-24 11:01:14.620 HelloWorld[56128:350791] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
###解決方法:
禁用https :
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
* ##錯(cuò)誤3
>```
You are currently running Node v0.12.0 but React Native requires >=4. Please use a supported version of Node.
See https://facebook.github.io/react-native/docs/getting-started.html
解決方法:
安裝一個(gè)nvm,通過nvm安裝一個(gè)nodejs4.0以上的版本
<span>
brew install nvm
-
vim bash_profile 添加自動(dòng)啟動(dòng)
- export NVM_DIR=~/.nvm
- source $(brew --prefix nvm)/nvm.sh
source bash_profile
nvm install v4.2.4
sudo react-navtive init HelloWorld(項(xiàng)目名稱)
</span>
<a >傳送門1</a>
<a href = "http://www.lxweimin.com/p/078d9900a7c8">傳送門2</a>
-
錯(cuò)誤4
項(xiàng)目init 成功 但是無讀寫權(quán)限解決辦法:
<a >傳送門<a>