- 1.在iOS模拟器中无法调用Command+R进行刷新
分析: 将模拟器的操作关闭了
解决办法:将模拟器中国Hardware->Keyboard->Connect Hardware Keyboard打开即可
- 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。注意版本号必须精确到两个小数点。