美文网首页
CocoaPods的安装及使用

CocoaPods的安装及使用

作者: 破夕_____________ | 来源:发表于2016-01-06 17:02 被阅读48次

    开源库的使用

    1.CocoaPods的安装及使用

    2.利用开源库Diplomat实现分享及第三方登录

    3.git的使用

    1.CocoaPods的安装及使用:
    http://code4app.com/article/cocoapods-install-usage
    http://objccn.io/issue-6-4/
    http://www.jianshu.com/p/5fc15906c53a

    查看当前的源
    gem sources -l

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

    //等有反应之后再敲入以下命令,添加淘宝镜像
    gem sources -a https://ruby.taobao.org/

    只有在终端中出现下面文字才表明你上面的命令是成功的:
    *** CURRENT SOURCES ***
    https://ruby.taobao.org/

    这时候,你再次在终端中运行:
    --verbose参数表示显示指令的执行过程
    sudo gem install cocoapods --verbose

    //将 CocoaPods Specs repository复制到你电脑上~/.cocoapods目录下,
    它需要一点时间来完成,你等就是了
    pod setup

    如果安装失败 ~/.cocoapods 里面是空的,就需要重新setup
    命令如下:
    pod repo remove master
    pod setup

    执行pod setup如果出现如下报错


    [!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --depth=1

    xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)


    则执行:
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

    查看版本:
    pod --version

    搜索:
    pod search AFNetworking

    生成Podfile文件
    pod init

    Podfile文件示例:

    platform :ios, '6.0'

    target 'iOSDevTemplate' do
    pod 'AFNetworking', '~>2.6.0' #指定版本号
    pod 'MBProgressHUD' #不指定版本号,使用最新版本

    end

    下载开源库:
    pod install --no-repo-update --verbose

    更新开源库:
    pod update --no-repo-update --verbose

    更新本地索引库
    pod repo update --verbose

    2.利用开源库Diplomat实现分享及第三方登录:

    微信,微博,QQ,支付宝等通过下面唯一标识跳回本应用
    <key>CFBundleURLTypes</key>
    <array>
    <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLSchemes</key>
    <array>
    <string>wb1815822993</string>
    <string>wxd930ea5d5a258f4f</string>
    <string>tencent1102909370</string>
    </array>
    </dict>
    </array>

    //iOS9.0新增,允许不安全的网络传输
    <key>NSAppTransportSecurity</key>
    <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    </dict>

    //iOS9.0新增,URL Scheme 白名单
    <key>LSApplicationQueriesSchemes</key>
    <array>
    <string>wechat</string>
    <string>weixin</string>
    <string>sinaweibohd</string>
    <string>sinaweibo</string>
    <string>weibosdk</string>
    <string>weibosdk2.5</string>
    <string>mqqapi</string>
    <string>mqq</string>
    <string>mqqOpensdkSSoLogin</string>
    <string>mqqconnect</string>
    <string>mqqopensdkdataline</string>
    <string>mqqopensdkgrouptribeshare</string>
    <string>mqqopensdkfriend</string>
    <string>mqqopensdkapi</string>
    <string>mqqopensdkapiV2</string>
    <string>mqqopensdkapiV3</string>
    <string>mqzoneopensdk</string>
    <string>wtloginmqq</string>
    <string>wtloginmqq2</string>
    <string>mqqwpa</string>
    <string>mqzone</string>
    <string>mqzonev2</string>
    <string>mqzoneshare</string>
    <string>wtloginqzone</string>
    <string>mqzonewx</string>
    <string>mqzoneopensdkapiV2</string>
    <string>mqzoneopensdkapi19</string>
    <string>mqzoneopensdkapi</string>
    <string>mqzoneopensdk</string>
    </array>

    分享Demo:https://github.com/sinofake/ShareDemo
    Diplomat地址:https://github.com/lingochamp/Diplomat

    开源中国:http://git.oschina.net/oschina/iphone-app
    https://github.com/thoughtbot/Tropos
    https://github.com/itjhDev/itjh
    https://github.com/ltebean/novel-design
    https://github.com/coderyi/Monkey
    土豆:https://github.com/lookingstars/tudou
    美团:https://github.com/lookingstars/meituan
    https://github.com/lookingstars/chuanke
    网易框架:https://github.com/dsxNiubility/SXNews
    https://github.com/12207480/KnowingLife
    https://github.com/Coding/Coding-iOS
    https://github.com/haolloyin/MrCode

    生成pub文件
    ssh-keygen -t rsa -C "cuirong.zhu@corp.elong.com"

    10.11版本及以上
    command+r 开机进入恢复模式
    csrutil disable

    更新升级10.11 cocoapods安装出问题最简单的解决方法
    这是因为10.11把cocoapods直接干掉了
    sudo gem install -n /usr/local/bin cocoapods
    再加一句,完美解决
    sudo xcode-select --switch /Applications/Xcode.app

    pod update 试了还可以用

    pod install 被墙了,请大家换成pod install --verbose --no-repo-update

    相关文章

      网友评论

          本文标题:CocoaPods的安装及使用

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