- 1.在iOS模擬器中無法調用Command+R進行刷新
分析: 將模擬器的操作關閉了
解決辦法:將模擬器中國Hardware->Keyboard->Connect Hardware Keyboard打開即可
圖片.png
- 2.新創建的ReactNative項目,在項目文件夾下執行react-native run-ios,但是出現以下報錯(2017年7月4日)
** BUILD FAILED **
The following commands produced analyzer issues:
Analyze /Users/xietao/Desktop/HanQiaoNote/項目源碼/DouBanProject/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.c
Analyze /Users/xietao/Desktop/HanQiaoNote/項目源碼/DouBanProject/node_modules/react-native/ReactCommon/yoga/yoga/YGNodeList.c
(2 commands with analyzer issues)
The following build commands failed:
PhaseScriptExecution Install\ Third\ Party /Users/xietao/Desktop/HanQiaoNote/項目源碼/DouBanProject/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/DouBanProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DouBanProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
報錯
原因:init命令默認會創建最新的版本,而目前最新的0.45版本需要下載boost庫編譯。此庫體積龐大,在國內即便翻墻也很難下載成功,導致很多人無法正常運行iOS項目,推薦暫時使用0.44.3的版本。
解決辦法: 創建項目暫時先使用react-native init MyApp --version 0.44.3,指定某個版本。
你可以使用--version參數(注意是兩個杠)創建指定版本的項目。例如react-native init MyApp --version 0.44.3。注意版本號必須精確到兩個小數點。