基础环境搭建
环境搭建参考 http://blog.youkuaiyun.com/huxiaoqiao163/article/details/51423903, 感谢作者
遇到的问题
1、xcode 最好升级到最新版本, 要不以后开发中会遇到很多莫名其妙的问题
2、运行ios 时,报错 crun: error: unable to find utility "instruments", not a developer tool or in PATH
执行命令 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer 运行后 出现
Found Xcode project AwesomeProject.xcodeproj
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
Command failed: xcrun instruments -s
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
根据提示 打开 Xcode 点击同意,就安装提示了,安装之后再看看 Ok,可以了。 这个原因可能是因为我升级了xcode, 需要打开后确认
3、运行iOS 出现 Print: Entry, ":CFBundleIdentifier", Does Not Exist
这个是由于之前我用的reactnative 版本低于0.45一下, 后来在window平台将rn升级到0.45以上。mac 0.45以上需要 boost1.63.0
解决办法:执行rn升级 react-native upgrade ,正常应该是一路替换y, 由于我之前是在windows开发的android,所有我这暂时只替换苹果
3、React Native - ReactComponentTreeHook.purgeUnmountedComponents is not a function
报这个错 网上说 安装依赖的时候已经看到了一句警告:react-native@0.48.4" has incorrect peer dependency "react@16.0.0-alpha.12".但是被你忽略了。。。 但是我npm install 已经都安装了,
我的解决办法是 手工 npm install react@16.0.0-alpha.12 --save; npm install react-native@0.46.0 --save 就好使了
4、 HTTP 访问不了的问题
iOS 强制要求使用 https,如果你请求的接口是 http协议就会出错,临时解决办法是在 Info.plist 里面加上:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
但是这个办法只能今年底前使用,之后苹果汇禁止这么用,所以尽快部署 https 接口。
react-native开发踩坑之 ios上react-native-vector-icons 的error:unRecognized font family 'FontAwesome'