Mac上搭建React Native开发环境

基础环境搭建

环境搭建参考 http://blog.csdn.net/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'


http://blog.csdn.net/jiangcs520/article/details/69366245 这个作者写的很好,一定要细渎里面关键的




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值