zoukankan      html  css  js  c++  java
  • CocoaPods的安装及使用/利用开源库Diplomat实现分享及第三方登录/git的使用

    2017最新总结CocoaPods安装细节及遇到的问题

    管理新增第三方库的步骤 

    <<史上最简洁版本>>

    1.gem sources -l查看 当前的源 

    //1.1 sudo -i、、以下都是以管理员的身份来操作的

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

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

    4.xcode-select --install 

    5.gem install cocoapods 

    6.pod repo remove master

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

    8.pod repo update 

    9.pod search AFNetworking 

    10.cd XXX

    11.pod install

    或者

    开源库的使用

    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


    查看当前的源
    1.gem sources -l

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

    //等有反应之后再敲入以下命令,添加淘宝镜像

    3.gem sources --add https://ruby.taobao.org/ 


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


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


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

    6.pod repo remove master

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


    如果安装失败 ~/.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


    如果Ruby环境不够新,可能需要更新以下:
    sudo gem update --system

    查看版本:
    8.pod --version

    搜索:
    9.pod search AFNetworking

    生成Podfile文件
    10.pod init


    11.Podfile文件示例:

    platform :ios, '6.0'

    target 'iOSDevTemplate' do
    pod 'AFNetworking' //不显式指定依赖库版本,表示每次都获取最新版本
    pod 'AFNetworking', ‘2.0’ //只使用2.0版本
    pod 'AFNetworking', ‘>2.0′ //使用高于2.0的版本
    pod 'AFNetworking', ‘>=2.0′ //使用大于或等于2.0的版本
    pod 'AFNetworking', ‘<2.0′ //使用小于2.0的版本
    pod 'AFNetworking', ‘<=2.0′ //使用小于或等于2.0的版本
    pod 'AFNetworking', ‘~>0.1.2′ //使用大于等于0.1.2但小于0.2的版本,相当于>=0.1.2并且<0.2.0
    pod ‘AFNetworking’, ‘~>0.1′ //使用大于等于0.1但小于1.0的版本
    pod ‘AFNetworking’, ‘~>0′ //高于0的版本,写这个限制和什么都不写是一个效果,都表示使用最新版本

    end

    12.下载开源库:<今后经常使用的>//当你每次需要加入第三方库的时候。。。
    pod install --no-repo-update --verbose


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


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

     15.注意:##使用pod管理的第三方库,导入头文件时,需要使用尖括号<>,,如:#import <UMSocial.h>,,,如果不采用pod管理第三方库的话,#import "UMSocial.h"##

    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>


    百度地图URL Scheme:baidumap
    高德地图: iosamap

    <!-- 支付宝 URL Scheme 白名单-->
    <string>alipay</string>
    <string>alipayshare</string>

    分享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/RyanTech/nuomi
    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
    http://www.jianshu.com/p/23c01067cf7e


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

  • 相关阅读:
    CentOS 下实现两台服务器之间的共享NFS
    CentOS 下安装无线哥的老爷机DELL的无线驱动
    PHP 如何读取一个1G的文件大小
    php 经典的算法题你懂的
    mongodb与mysql命令对比
    TCP协议的三次握手和四次挥手过程
    java 发送带Basic Auth认证的http post请求实例代码
    HTTP基本认证(Basic Authentication)的JAVA实例代码
    Http协议
    MySQL主从同步那点事儿
  • 原文地址:https://www.cnblogs.com/lrr0618/p/5082323.html
Copyright © 2011-2022 走看看