美文网首页
(CocoaPods) - 20200512 CocoaPods

(CocoaPods) - 20200512 CocoaPods

作者: 粒粒皇 | 来源:发表于2020-05-13 15:30 被阅读0次

    闲着没事(卡卡卡卡)重做系统,也为了使用最新的 Xcode版本,更新到最新的系统版本

    image.png

    1 安装 CocoaPods

    1.1 ruby 更新(Catalina 的 ruby 是 2.6.3 版本,不需要更新,1.1 这一步可以跳过)
    ruby 版本
    // 查询ruby版本号
    $ ruby -v 
    
    // 更新ruby
    $ sudo gem update --system 
    
    1.2 ruby 更换镜像
    // 查询当前镜像
    $ gem sources -l
    
    // 移除默认镜像
    $ gem sources --remove https://rubygems.org/
    
    // 添加国内镜像
    $ gem sources -a https://gems.ruby-china.com/
    

    2 安装 CocoaPods (我安装的版本是 1.9.1)

    // 安装 CocoaPods 命令
    $ sudo gem install cocoapods
    
    // CocoaPods 安装完成后,继续输入命令
    $ pod setup
    
    • pod setup 很快就完成

    CocoaPods 1.8 switches the CDN as the default spec repo source and comes with a few enhancements!

    3 使用

    3.1 官方 BLOG 说明,有个视频很清楚
    3.2 创建工程
    // 添加 pod 支持,init
    $ pod init
    
    // 编辑 Podfile 之后,install
    $ pod install
    
    image.png
    3.3 如果在 pod install 时提示
    CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/d/a/2/Alamofire/5.1.0/Alamofire.podspec.json Response: Couldn't connect to server
    
    • 修改hosts
    // 修改hosts
    $ sudo vim /etc/hosts
    
    // 在下面添加一行,保存退出
    199.232.4.133 raw.githubusercontent.com
    
    修改 hosts

    相关文章

      网友评论

          本文标题:(CocoaPods) - 20200512 CocoaPods

          本文链接:https://www.haomeiwen.com/subject/ulpnnhtx.html