CocoaPods安装教程

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’

  • Homepage: https://github.com/AFNetworking/AFNetworking
  • Source: https://github.com/AFNetworking/AFNetworking.git
  • Versions: 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 3.0.0-beta.3, 3.0.0-beta.2,
    3.0.0-beta.1, 2.6.3, 2.6.2, 2.6.1, 2.6.0, 2.5.4, 2.5.3, 2.5.2, 2.5.1, 2.5.0,
    2.4.1, 2.4.0, 2.3.1, 2.3.0, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.0, 2.0.3,
    2.0.2, 2.0.1, 2.0.0, 2.0.0-RC3, 2.0.0-RC2, 2.0.0-RC1, 1.3.4, 1.3.3, 1.3.2,
    1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0, 1.0RC3, 1.0RC2, 1.0RC1,
    0.10.1, 0.10.0, 0.9.2, 0.9.1, 0.9.0, 0.7.0, 0.5.1 [master repo]
  • Subspecs:
    • AFNetworking/Serialization (3.0.4)
    • AFNetworking/Security (3.0.4)
    • AFNetworking/Reachability (3.0.4)
    • AFNetworking/NSURLSession (3.0.4)
    • AFNetworking/UIKit (3.0.4)

-> AFNetworking+AutoRetry (0.0.5)
Auto Retries for AFNetworking requests
pod ‘AFNetworking+AutoRetry’, ‘~> 0.0.5’

  • Homepage: https://github.com/shaioz/AFNetworking-AutoRetry
  • Source: https://github.com/shaioz/AFNetworking-AutoRetry.git
  • Versions: 0.0.5, 0.0.4, 0.0.3, 0.0.2, 0.0.1 [master repo]

-> AFNetworking+Ext (1.2.1)
AFNetworking的封装, 并提供一个 UIImageView+DYLoading cache in fileSystem+memory
pod ‘AFNetworking+Ext’, ‘~> 1.2.1’

  • Homepage: https://github.com/junhaiyang/AFNetworkingExt
  • Source: https://github.com/junhaiyang/AFNetworkingExt.git
  • Versions: 1.2.1, 1.2, 1.1, 1.0, 0.5, 0.4, 0.3 [master repo]
  • Subspecs:
    • AFNetworking+Ext/Base (1.2.1)
    • AFNetworking+Ext/AFCustomRequestOperation (1.2.1)
    • AFNetworking+Ext/AFDownloadRequestOperation (1.2.1)
    • AFNetworking+Ext/AFTextResponseSerializer (1.2.1)
    • AFNetworking+Ext/example (1.2.1)
    • AFNetworking+Ext/UIKit (1.2.1)
    • AFNetworking+Ext/UIKit/UIImageView+DYLoading (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’

  • Homepage:
    https://github.com/JRG-Developer/AFNetworking-ImageActivityIndicator
  • Source:
    https://github.com/JRG-Developer/AFNetworking-ImageActivityIndicator.git
  • Versions: 1.0.2, 1.0.1, 1.0.0 [master repo]

-> AFNetworking+SingleBlock (0.0.1)
Categories that aggregate the success and failure block in one single
solution
pod ‘AFNetworking+SingleBlock’, ‘~> 0.0.1’

  • Homepage: https://github.com/acerbetti/AFNetworking-SingleBlock
  • Source: https://github.com/acerbetti/AFNetworking-SingleBlock.git
  • Versions: 0.0.1 [master repo]

-> AFNetworking+streaming (0.6.2)
A very quick extension to AFNetworking that adds stream based parsing
pod ‘AFNetworking+streaming’, ‘~> 0.6.2’

  • Homepage: https://github.com/deanWombourne/AFNetworking-streaming
  • Source: https://github.com/deanWombourne/AFNetworking-streaming.git
  • Versions: 0.6.2, 0.6.1, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 [master repo]
  • Subspecs:
    • AFNetworking+streaming/Core (0.6.2)
    • AFNetworking+streaming/Json (0.6.2)

-> AFNetworking-BoltsSupport (1.1.0)
Bolts support for AFNetworking.
pod ‘AFNetworking-BoltsSupport’, ‘~> 1.1.0’

  • Homepage: https://github.com/taka0125/AFNetworking-BoltsSupport
  • Source: https://github.com/taka0125/AFNetworking-BoltsSupport.git
  • Versions: 1.1.0, 1.0.0 [master repo]

-> AFNetworking-MUResponseSerializer (1.0.1)
Automatically serialize JSON response to your object model. It also works
with NSManagedObjects
pod ‘AFNetworking-MUResponseSerializer’, ‘~> 1.0.1’

  • Homepage: https://github.com/Ulianko/AFNetworking-MUResponseSerializer
  • Source: https://github.com/Ulianko/AFNetworking-MUResponseSerializer.git
  • Versions: 1.0.1, 1.0.0 [master repo]

-> AFNetworking-PromiseKit (0.2.4)
AFNetworking category for PromiseKit
pod ‘AFNetworking-PromiseKit’, ‘~> 0.2.4’

  • Homepage: https://github.com/cmckni3/AFNetworking-PromiseKit
  • Source: https://github.com/cmckni3/AFNetworking-PromiseKit.git
  • Versions: 0.2.4, 0.2.3, 0.2.2, 0.2.1, 0.2.0, 0.1.0 [master repo]

-> 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’

  • Homepage: https://github.com/CodaFi/AFNetworking-RACExtensions
  • Source: https://github.com/CodaFi/AFNetworking-RACExtensions.git
  • Versions: 0.1.8, 0.1.6, 0.1.4, 0.1.2, 0.1.1, 0.0.1 [master repo]

-> 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’

  • Homepage: https://github.com/legoless/AFNetworking-RACRetryExtensions
  • Source: https://github.com/legoless/AFNetworking-RACRetryExtensions.git
  • Versions: 0.2.0, 0.1.2, 0.1.1 [master repo]

-> AFNetworking-ReactiveCocoa (0.0.2)
Make AFNetworking reactive.
pod ‘AFNetworking-ReactiveCocoa’, ‘~> 0.0.2’

  • Homepage: https://github.com/uasi/AFNetworking-ReactiveCocoa
  • Source: https://github.com/uasi/AFNetworking-ReactiveCocoa.git
  • Versions: 0.0.2, 0.0.1 [master repo]

-> AFNetworking-Synchronous (0.3.1)
Synchronous requests for AFNetworking
pod ‘AFNetworking-Synchronous’, ‘~> 0.3.1’

  • Homepage: https://github.com/paulmelnikow/AFNetworking-Synchronous
  • Source: https://github.com/paulmelnikow/AFNetworking-Synchronous.git
  • Versions: 0.3.1, 0.3.0, 0.2.0, 0.1.0 [master repo]
  • Subspecs:
    • AFNetworking-Synchronous/1.x (0.3.1)
    • AFNetworking-Synchronous/2.x (0.3.1)

-> AFNetworking-Webp (0.2)
A Webp image response serializer for AFNetworking 2.0
pod ‘AFNetworking-Webp’, ‘~> 0.2’

  • Homepage: https://github.com/brandons/AFNetworking-Webp
  • Source: https://github.com/brandons/AFNetworking-Webp.git
  • Versions: 0.2, 0.1 [master repo]

-> 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’

  • Homepage: https://github.com/knshiro/AFNetworking-RACExtensions
  • Source: https://github.com/knshiro/AFNetworking-RACExtensions.git
  • Versions: 0.0.1 [master repo]

-> AFNetworkingHelper (0.1.4)
A short wrapper written over AFNetworking library.
pod ‘AFNetworkingHelper’, ‘~> 0.1.4’

  • Homepage: https://github.com/RainingClouds/AFNetworkingHelper
  • Source: https://github.com/RainingClouds/AFNetworkingHelper.git
  • Versions: 0.1.4, 0.1.3, 0.1.2, 0.1.1, 0.1.0 [master repo]

-> CollectionUtils-AFNetworking (1.0.2)
CollectionUtils additions for AFNetworking.
pod ‘CollectionUtils-AFNetworking’, ‘~> 1.0.2’

  • Homepage: https://github.com/kishikawakatsumi/CollectionUtils
  • Source: https://github.com/kishikawakatsumi/CollectionUtils.git
  • Versions: 1.0.2, 1.0.1, 1.0.0 [master repo]

-> CollectionUtils-AFNetworking-1.3 (1.0.1)
CollectionUtils additions for AFNetworking 1.3.x.
pod ‘CollectionUtils-AFNetworking-1.3’, ‘~> 1.0.1’

  • Homepage: https://github.com/kishikawakatsumi/CollectionUtils
  • Source: https://github.com/kishikawakatsumi/CollectionUtils.git
  • Versions: 1.0.1, 1.0.0 [master repo]

-> HYVConfiguratorAFNetworking-Mantle (0.6.3)
Configurator for using AFNetworking with Mantle
pod ‘HYVConfiguratorAFNetworking-Mantle’, ‘~> 0.6.3’

  • Homepage:
    https://github.com/LilushFess/HYVConfiguratorAFNetworking-Mantle.git
  • Source:
    https://github.com/LilushFess/HYVConfiguratorAFNetworking-Mantle.git
  • Versions: 0.6.3, 0.6.2, 0.6.1, 0.6, 0.4.1, 0.4, 0.3.1, 0.3.0, 0.2.1, 0.2.0,
    0.1.4, 0.1.3.2, 0.1.3.1, 0.1.3, 0.1.2.2, 0.1.2, 0.1.1.42, 0.1.0 [master repo]

-> Haneke+AFNetworking (0.2.0)
Haneke extension to use AFNetworking to download images.
pod ‘Haneke+AFNetworking’, ‘~> 0.2.0’

  • Homepage: https://github.com/Haneke/Haneke-AFNetworking
  • Source: https://github.com/Haneke/Haneke-AFNetworking.git
  • Versions: 0.2.0 [master repo]

-> JJAFNetworking (1.0)
A Networking Tool used on iOS.
pod ‘JJAFNetworking’, ‘~> 1.0’

  • Homepage: https://github.com/JayJJ/JJAFNetworking
  • Source: https://github.com/JayJJ/JJAFNetworking.git
  • Versions: 1.0 [master repo]

-> PromiseKit-AFNetworking (0.6.0)
PromiseKit extensions for AFNetworking
pod ‘PromiseKit-AFNetworking’, ‘~> 0.6.0’

  • Homepage: https://github.com/csotiriou/AFNetworking-PromiseKit/
  • Source: https://github.com/csotiriou/AFNetworking-PromiseKit.git
  • Versions: 0.6.0, 0.5.1, 0.5.0, 0.1.7, 0.1.6, 0.1.5, 0.1.4, 0.1.3, 0.1.2,
    0.1.1 [master repo]

-> UIImageView_AFNetworking-Blocks (0.1.0)
UIImageView+AFNetworking with a single completion block for success and
failure.
pod ‘UIImageView_AFNetworking-Blocks’, ‘~> 0.1.0’

  • Homepage: https://github.com/pixio/UIImageView_AFNetworking-Blocks
  • Source: https://github.com/pixio/UIImageView_AFNetworking-Blocks.git
  • Versions: 0.1.0 [master repo]
    //导入Xcode项目工程目录(项目已经打开)
    haijunyans-MacBook-Pro:~ haijunyan$ cd /Users/haijunyan/Desktop/Demo

//将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$ (终端指令完成结束标志)

你可能感兴趣的:(IOS,环境配置)