美文网首页
CocoaPods相关

CocoaPods相关

作者: 程守斌 | 来源:发表于2017-02-15 15:30 被阅读27次

    安装

    gem sources --remove https://rubygems.org/

    gem sources -a https://ruby.taobao.org/

    gem sources -l

    sudo gem install cocoapods

    pod setup //初始化(下载几十M很慢)

    使用镜像索引

    pod repo remove master

    pod repo add master https://gitcafe.com/akuandev/Specs.git

    pod repo update

    使用步骤

    创建或打开Xcode项目

    命令行cd到项目目录

    使用pod init 创建Podfile

    修改Podfile

    pod install

    打开pod创建的xcworkspace

    Podfile

    podspec源

    source 'https://git.coding.net/lee8001/linjiahaoyi.git'

    source 'https://github.com/CocoaPods/Specs.git'

    platform :ios, '8.0' 兼容iOS版本

    use_frameworks! 使用动态的连接库

    inhibit_all_warning! 消除所有的pod库警告

    target ‘PodTest’ do  给PodTest项目使用pod库

         pod 'AFNetworking', '~>3.0'

    end

    命令

    pod install 安装Podfile.lock中锁定的版本的pods

    pod update 会更新到最新版本或Podfile中指定版本

    使用pod update podName来更新指定pod版本

    pod install --verbose --no-repo-update 不更新repo安装

    use_frameworks!  swift项目必须开启该选项,因为swift项目不支持静态库

    podspec和私有pods

    创建

    cd 到项目目录

    pod spec create MyFramework

    Podfile

    target 'PodTest' do

    pod 'MyFramework', :git => 'https://github.com/hefeijinbo/MyFramework.git'

    pod 'MyFramework', :path => '路径'

    end

    相关文章

      网友评论

          本文标题:CocoaPods相关

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