CocoaPods自动管理第三方库
CocoaPods安装教程网站:
file:///Users/haijunyan/Desktop/史上最详细的CocoaPods安装教程%20-%20Objective-c%20-%20次元立方网%20-%20电脑知识与技术互动交流平台.webarchive
file:///Users/haijunyan/Desktop/CocoaPods安装和使用%20-%20wayne23%20-%20博客园.webarchive
http://code4app.com/article/cocoapods-install-usage
注意:pod install的下载实际上是从本地库下载第三方类库至项目中,对于之前没有使用过的第三方类库必须进行本地库的更新
Setting up CocoaPods master repo设置CocoaPods主资源库
清理当前 CocoaPods的资源目录终端执行以下命令:
pod repo remove master
pod setup
setup成功后执行install
详细具体全套指令:
//官方Ruby环境升级更新
Last login: Fri Dec 25 19:48:23 on console
haijunyans-MacBook-Pro:~ haijunyan$ sudo gem update --system
Password:
Latest version currently installed. Aborting.
haijunyans-MacBook-Pro:~ haijunyan$
haijunyans-MacBook-Pro:~ haijunyan$ pod search AFNetworking
-bash: pod: command not found
haijunyans-MacBook-Pro:~ haijunyan$ search AFNetworking
-bash: search: command not found
haijunyans-MacBook-Pro:~ haijunyan$ touch Podfile
haijunyans-MacBook-Pro:~ haijunyan$ gem update --system
Latest version currently installed. Aborting.(官方系统下的最新版本Ruby环境,中国境内不好用)
haijunyans-MacBook-Pro:~ haijunyan$ sudo gem update —system(官方系统的最新版本Ruby环境下的cocoapods的gem包)
Password:
Updating installed gems
Nothing to update
//通过淘宝的ruby镜像环境(境内好用)替换掉官方Ruby环境
haijunyans-MacBook-Pro:~ haijunyan$ gem sources --remove https://rubygems.org/
source https://rubygems.org/ not present in cache
haijunyans-MacBook-Pro:~ haijunyan$ gem sources --removehttps://rubygems.org/
ERROR: While executing gem … (OptionParser::InvalidOption)
invalid option: --removehttps://rubygems.org/
haijunyans-MacBook-Pro:~ haijunyan$ gem sources --remove https://rubygems.org/
source https://rubygems.org/ not present in cache
haijunyans-MacBook-Pro:~ haijunyan$ gem sources -a https://ruby.taobao.org/
source https://ruby.taobao.org/ already present in the cache
haijunyans-MacBook-Pro:~ haijunyan$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/(替换成功)
//在淘宝的ruby镜像环境下安装cocoapods工具指令包(平台)
Password:
haijunyans-MacBook-Pro:~ haijunyan$ sudo gem install cocoapods
Password:
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.8.3.gem (100%)
Successfully installed minitest-5.8.3
Fetching: activesupport-4.2.5.gem (100%)
Successfully installed activesupport-4.2.5
Fetching: nap-1.0.0.gem (100%)
Successfully installed nap-1.0.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-0.39.0.gem (100%)
Successfully installed cocoapods-core-0.39.0
Fetching: claide-0.9.1.gem (100%)
Successfully installed claide-0.9.1
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: xcodeproj-0.28.2.gem (100%)
Successfully installed xcodeproj-0.28.2
Fetching: cocoapods-downloader-0.9.3.gem (100%)
Successfully installed cocoapods-downloader-0.9.3
Fetching: cocoapods-plugins-0.4.2.gem (100%)
Successfully installed cocoapods-plugins-0.4.2
Fetching: cocoapods-search-0.1.0.gem (100%)
Successfully installed cocoapods-search-0.1.0
Fetching: cocoapods-stats-0.6.2.gem (100%)
Successfully installed cocoapods-stats-0.6.2
Fetching: cocoapods-try-0.5.1.gem (100%)
Successfully installed cocoapods-try-0.5.1
Fetching: netrc-0.7.8.gem (100%)
Successfully installed netrc-0.7.8
Fetching: cocoapods-trunk-0.6.4.gem (100%)
Successfully installed cocoapods-trunk-0.6.4
Fetching: molinillo-0.4.0.gem (100%)
Successfully installed molinillo-0.4.0
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: cocoapods-0.39.0.gem (100%)
Successfully installed cocoapods-0.39.0
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for minitest-5.8.3
Installing ri documentation for minitest-5.8.3
Parsing documentation for activesupport-4.2.5
unable to convert “\x84” from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping
Installing ri documentation for activesupport-4.2.5
Parsing documentation for nap-1.0.0
Installing ri documentation for nap-1.0.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for cocoapods-core-0.39.0
Installing ri documentation for cocoapods-core-0.39.0
Parsing documentation for claide-0.9.1
Installing ri documentation for claide-0.9.1
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for xcodeproj-0.28.2
Installing ri documentation for xcodeproj-0.28.2
Parsing documentation for cocoapods-downloader-0.9.3
Installing ri documentation for cocoapods-downloader-0.9.3
Parsing documentation for cocoapods-plugins-0.4.2
Installing ri documentation for cocoapods-plugins-0.4.2
Parsing documentation for cocoapods-search-0.1.0
Installing ri documentation for cocoapods-search-0.1.0
Parsing documentation for cocoapods-stats-0.6.2
Installing ri documentation for cocoapods-stats-0.6.2
Parsing documentation for cocoapods-try-0.5.1
Installing ri documentation for cocoapods-try-0.5.1
Parsing documentation for netrc-0.7.8
Installing ri documentation for netrc-0.7.8
Parsing documentation for cocoapods-trunk-0.6.4
Installing ri documentation for cocoapods-trunk-0.6.4
Parsing documentation for molinillo-0.4.0
Installing ri documentation for molinillo-0.4.0
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-0.39.0
Installing ri documentation for cocoapods-0.39.0
21 gems installed
//成功安装后,CocoaPods的使用
haijunyans-MacBook-Pro:~ haijunyan$ pod search AFNetworking(通过search指令判断第三方开源代码类库是否支持CocoaPods的管理)
Setting up CocoaPods master repo
Setup completed
-> AFNetworking (3.0.4)
A delightful iOS and OS X networking framework.
pod ‘AFNetworking’, ‘~> 3.0.4’
-> AFNetworking+AutoRetry (0.0.5)
Auto Retries for AFNetworking requests
pod ‘AFNetworking+AutoRetry’, ‘~> 0.0.5’
-> AFNetworking+Ext (1.2.1)
AFNetworking的封装, 并提供一个 UIImageView+DYLoading cache in fileSystem+memory
pod ‘AFNetworking+Ext’, ‘~> 1.2.1’
-> AFNetworking+ImageActivityIndicator (1.0.2)
AFNetworking+ImageActivityIndicator makes it easy to show an activity
indicator while an image view’s image is loading using AFNetworking.
pod ‘AFNetworking+ImageActivityIndicator’, ‘~> 1.0.2’
-> AFNetworking+SingleBlock (0.0.1)
Categories that aggregate the success and failure block in one single
solution
pod ‘AFNetworking+SingleBlock’, ‘~> 0.0.1’
-> AFNetworking+streaming (0.6.2)
A very quick extension to AFNetworking that adds stream based parsing
pod ‘AFNetworking+streaming’, ‘~> 0.6.2’
-> AFNetworking-BoltsSupport (1.1.0)
Bolts support for AFNetworking.
pod ‘AFNetworking-BoltsSupport’, ‘~> 1.1.0’
-> AFNetworking-MUResponseSerializer (1.0.1)
Automatically serialize JSON response to your object model. It also works
with NSManagedObjects
pod ‘AFNetworking-MUResponseSerializer’, ‘~> 1.0.1’
-> AFNetworking-PromiseKit (0.2.4)
AFNetworking category for PromiseKit
pod ‘AFNetworking-PromiseKit’, ‘~> 0.2.4’
-> AFNetworking-RACExtensions (0.1.8)
AFNetworking-RACExtensions is a delightful extension to the AFNetworking
classes for iOS and Mac OS X.
pod ‘AFNetworking-RACExtensions’, ‘~> 0.1.8’
-> AFNetworking-RACRetryExtensions (0.2.0)
AFNetworking-RACRetryExtensions is an extension to the AFNetworking classes
for iOS and Mac OS X that adds the auto-retry ability.
pod ‘AFNetworking-RACRetryExtensions’, ‘~> 0.2.0’
-> AFNetworking-ReactiveCocoa (0.0.2)
Make AFNetworking reactive.
pod ‘AFNetworking-ReactiveCocoa’, ‘~> 0.0.2’
-> AFNetworking-Synchronous (0.3.1)
Synchronous requests for AFNetworking
pod ‘AFNetworking-Synchronous’, ‘~> 0.3.1’
-> AFNetworking-Webp (0.2)
A Webp image response serializer for AFNetworking 2.0
pod ‘AFNetworking-Webp’, ‘~> 0.2’
-> AFNetworking2-RACExtensions (0.0.1)
AFNetworking-RACExtensions is a delightful extension to the AFNetworking
classes for iOS and Mac OS X.
pod ‘AFNetworking2-RACExtensions’, ‘~> 0.0.1’
-> AFNetworkingHelper (0.1.4)
A short wrapper written over AFNetworking library.
pod ‘AFNetworkingHelper’, ‘~> 0.1.4’
-> CollectionUtils-AFNetworking (1.0.2)
CollectionUtils additions for AFNetworking.
pod ‘CollectionUtils-AFNetworking’, ‘~> 1.0.2’
-> CollectionUtils-AFNetworking-1.3 (1.0.1)
CollectionUtils additions for AFNetworking 1.3.x.
pod ‘CollectionUtils-AFNetworking-1.3’, ‘~> 1.0.1’
-> HYVConfiguratorAFNetworking-Mantle (0.6.3)
Configurator for using AFNetworking with Mantle
pod ‘HYVConfiguratorAFNetworking-Mantle’, ‘~> 0.6.3’
-> Haneke+AFNetworking (0.2.0)
Haneke extension to use AFNetworking to download images.
pod ‘Haneke+AFNetworking’, ‘~> 0.2.0’
-> JJAFNetworking (1.0)
A Networking Tool used on iOS.
pod ‘JJAFNetworking’, ‘~> 1.0’
-> PromiseKit-AFNetworking (0.6.0)
PromiseKit extensions for AFNetworking
pod ‘PromiseKit-AFNetworking’, ‘~> 0.6.0’
-> UIImageView_AFNetworking-Blocks (0.1.0)
UIImageView+AFNetworking with a single completion block for success and
failure.
pod ‘UIImageView_AFNetworking-Blocks’, ‘~> 0.1.0’
//将CocoaPods平台指令包引入项目中
haijunyans-MacBook-Pro:Demo haijunyan$ pod init (创建Podfile命令)(Podfile文件为待管理菜单文件)
haijunyans-MacBook-Pro:Demo haijunyan$ pod install (计算机很卡时采用此指令替换pod install --verbose --no-repo-update
)
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use Demo.xcworkspace
for this project from now on.
Sending stats
Pod installation complete! There are 0 dependencies from the Podfile and 0 total
pods installed.
[!] [!] The Podfile does not contain any dependencies.
haijunyans-MacBook-Pro:Demo haijunyan$ pod install
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.0.4)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 totalpod installed.
haijunyans-MacBook-Pro:Demo haijunyan$ (终端指令完成结束标志)