iCoder我收录的代码

CocoaPods

2016-06-21  本文已影响551人  大斌小姜

[TOC]

安装

$ gem sources --add https://gems.ruby-china.org/ 
$ gem sources --remove https://rubygems.org/
$ gem sources -l 
# 确保只有 gems.ruby-china.org
 $ sudo gem install cocoapods 
// 错误提示
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.
// 安装命令
$ sudo gem install -n /usr/local/bin cocoapods
ERROR:  While executing gem ... (TypeError)
    no implicit conversion of nil into String
// 更新gem
sudo gem update --system

降低版本或卸载

$ gem list
$ sudo gem uninstall cocoapods
$ sudo gem uninstall cocoapods-core
$ sudo gem uninstall cocoapods-downloader
$ sudo gem uninstall cocoapods-plugins
$ sudo gem uninstall cocoapods-search
$ sudo gem uninstall cocoapods-stats
$ sudo gem uninstall cocoapods-trunk
$ sudo gem uninstall cocoapods-try

使用

$ pod search SDWebImage
$ cd /Users/wangzz/Desktop/Demo
$ touch Podfile

旧版本的配置写法

platform :ios,       '7.0'
pod 'JSONKit',       '~> 1.4'
pod 'Reachability',  '~> 3.0.0'
pod 'AFNetworking', '~> 3.0.4'  #网络库

1.0版本之后,格式有了些变化

use_frameworks!  # 如果引入swift库,则需要加这句
platform :ios, '9.0'  #平台号
target 'MyApp' do  #工程名
    pod 'AFNetworking', '~> 3.0.4'  #网络库
    pod 'RDVTabBarController', '~> 1.1.9'  #tabbar 
    pod 'Masonry', '~> 0.6.4'   #自动布局
    pod 'ReactiveCocoa', '~> 4.0.1'
    pod 'WebViewJavascriptBridge', '~> 5.0' #JS桥接
end
上一篇下一篇

猜你喜欢

热点阅读