MAC 安装cocoapods

2023-05-16

首先是看了文章:

http://code4app.com/article/cocoapods-install-usage

http://www.uml.org.cn/mobiledev/201411072.asp

一、检测以及配置Ruby环境

之后按照文章所说的步骤操作,完成工作后,将自己遇到的问题记录一下,因为系统版本不一样可能遇到的问题不一样,还有就是记录一遍可以加深自己的印象,

首先MAC系统已经有Ruby环境可以直接在终端输入命令:

sudo gem install cocoapods    安装cocoapods但是我这边报错如下:

ERROR:  While executing gem ...(Gem::DependencyError)

    Unable to resolve dependencies: cocoapodsrequires cocoapods-core (= 0.35.0), xcodeproj (~> 0.20.2),cocoapods-downloader (~> 0.8.0), cocoapods-try (~> 0.4.2),cocoapods-trunk (~> 0.4.1), molinillo (~> 0.1.2)

网上搜博文说是 Ruby环境版本问题解决方法是:在终端输入命令行:

gem update --system  报新错:

Updatingrubygems-update

Fetching:rubygems-update-2.4.6.gem (100%)

ERROR:  While executing gem ... (Gem::FilePermissionError)

    You don't have write permissions for the/Library/Ruby/Gems/2.0.0 directory.

据说是执行该命令行没有权限:于是在该命令行前加sudo:为:

sudo gem update--system

执行如下:

Updatingrubygems-update

Fetching:rubygems-update-2.4.6.gem (100%)

Successfullyinstalled rubygems-update-2.4.6

Parsingdocumentation for rubygems-update-2.4.6

Installing ridocumentation for rubygems-update-2.4.6

Installingdarkfish documentation for rubygems-update-2.4.6

InstallingRubyGems 2.4.6

RubyGems 2.4.6installed

Parsingdocumentation for rubygems-2.4.6

Installing ridocumentation for rubygems-2.4.6

 

=== 2.4.6 /2014-02-05

 

Bug fixes:

 

* Fixed resolvinggems with both upper and lower requirement boundaries.

  Issue #1141 by Jakub Jirutka.

* Moved extensiondirectory after require_paths to fix missing constant bugs

  in some gems with C extensions.  Issue #784 by André Arko, pull request

  #1137 by Barry Allard.

* UseGem::Dependency#requirement when adding a dependency to an existing

  dependency instance.  Pull request #1101 by Josh Cheek.

* Fixed warningof shadowed local variable in Gem::Specification.  Pull request

  #1109 by Rohit Arondekar

*Gem::Requirement should always sort requirements before coercion to Hash.

  Pull request #1139 by Eito Katagiri.

* The `gem open`command should change the current working directory before

  opening the editor.  Pull request #1142 by Alex Wood.

* Ensure quotesare stripped from the Windows launcher script used to install

  gems. Pull request #1115 by Youngjun Song.

* Fixed errorswhen writing to NFS to to 0444 files. Issue #1161 by Emmanuel

  Hadoux.

* Removed deadcode in Gem::StreamUI.  Pull request#1117 by mediaslave24.

* Fixedtypos.  Pull request #1096 by hakeda.

* Relaxed CMakedependency for RHEL 6 and CentOS 6.  Pullrequest #1124 by Vít

  Ondruch.

* Relaxed Psychdependency.  Pull request #1128 by VítOndruch.

 

=== 2.4.5 /2014-12-03

 

Bug fixes:

 

* Improved speedof requiring gems.  (Around 25% for a 60gem test).  Pull

  request #1060 by unak.

* RubyGems nolonger attempts to look up gems remotely with the --local flag.

  Pull request #1084 by Jeremy Evans.

* Executablestubs use the correct gem version when RUBYGEMS_GEMDEPS is

  active. Issue #1072 by Michael Kaiser-Nyman.

* Fixed handlingof pinned gems in lockfiles with versions. Issue #1078 by

  Ian Ker-Seymer.

* Fixed handlingof git@example:gem.git URIs.  Issue #1054by Mogutan Mogu.

* Fixed handlingof platforms retrieved from the dependencies API.  Issue

  #1058 and patch suggestion by tux-mind.

* RubyGems nowsuggests a copy-pasteable `gem pristine` command when

  extensions are missing.  Pull request #1057 by Shannon Skipper.

* Improved errorsfor long file names when packaging.  Pullrequest #1016 by

  Piotrek Bator.

* `gem pristine`now skips gems cannot be found remotely. Pull request #1064

  by Tuomas Kareinen.

* `gem pristine`now caches gems to the proper directory. Pull request #1064

  by Tuomas Kareinen.

* `gem pristine`now skips bundled gems properly.  Pullrequest #1064 by

  Tuomas Kareinen.

* Improvedinteroperability of Vagrant with RubyGems. Pull request #1057 by

  Vít Ondruch.

* RenamedCONTRIBUTING to CONTRIBUTING.rdoc to allow markup.  Pull request

  #1090 by Roberto Miranda.

* Switched from#partition to #reject as only one collection is used.  Pull

  request #1074 by Tuomas Kareinen.

* Fixedinstallation of gems on systems using memory-mapped files.  Pull

  request #1038 by Justin Li.

* Fixed bug inGem::Text#min3 where `a == b < c`. Pull request #1026 by

  fortissimo1997.

* Fixeduninitialized variable warning in BasicSpecification.  Pull request

  #1019 by Piotr Szotkowski.

* Removedunneeded exception handling for cyclic dependencies.  Pull request

  #1043 by Jens Wille.

* Fixed groupedexpression warning.  Pull request #1081by André Arko.

* Fixed handlingof platforms when writing lockfiles.

 

=== 2.4.4 /2014-11-12

 

Bug fixes:

 

* Add alternateRoot CA for upcoming certificate change. Fixes #1050 by

  Protosac

 

=== 2.4.3 /2014-11-10

 

Bug fixes:

 

* Fix redefineMirrorCommand issue. Pull request #1044 by @akr.

* Fix typo inplatform= docs.  Pull request #1048 by@jasonrclark

* Add root SSLcertificates for upcoming certificate change. Fixes #1050 by

  Protosac

 

=== 2.4.2 /2014-10-01

 

This release wassponsored by Ruby Central.

 

Bug fixes:

 

* RubyGems nowcorrectly matches wildcard no_proxy hosts. Issue #997 by

  voelzemo.

* Added supportfor missing git_source method in the gem dependencies API.

* Fixed handlingof git gems with an alternate install directory.

* Lockfiles willno longer be truncated upon resolution errors.

* Fixed messagingfor `gem owner -a`.  Issue #1004 by AaronPatterson, Ryan

  Davis.

* Removedmeaningless ensure.  Pull request #1003by gogotanaka.

* Improvedwording of --source option help.  Pullrequest #989 by Jason Clark.

* Emptybuild_info files are now ignored.  Issue#903 by Adan Alvarado.

* Gem::Installerignores dependency checks when installing development

  dependencies. Issue #994 by Jens Willie.

* `gem update`now continues after dependency errors. Issue #993 by aaronchi.

* RubyGems nolonger warns about semantic version dependencies for the 0.x

  range. Issue #987 by Jeff Felchner, pull request #1006 by Hsing-Hui Hsu.

* Added minimallock to allow multithread installation of gems. Issue #982

  and pull request #1005 by Yorick Peterse

* RubyGems nowconsiders prerelease dependencies as it did in earlier versions

  when --prerelease is given.  Issue #990 by Jeremy Tryba.

* Updatedcapitalization in README.  Issue #1010 byBen Bodenmiller.

* Fixedactivating gems from a Gemfile for default gems.  Issue #991 by khoan.

* Fixed windowsstub script generation for Cygwin.  Issue#1000 by Brett

  DiFrischia.

* Allow gembindir and ruby.exe to live in separate diretories.  Pull request

  #942 by Ian Flynn.

* Fixed handlingof gemspec in gem dependencies files to match Bundler

  behavior. Issue #1020 by Michal Papis.

* Fixed `gemupdate` when updating to prereleases. Issue #1028 by Santiago

  Pastorino.

* RubyGems nowfails immediately when a git reference cannot be found instead

  of spewing git errors.  Issue #1031 by Michal Papis

 

=== 2.4.1 /2014-07-17

 

Bug fixes:

 

* RubyGems cannow be updated on Ruby implementations that do not support

  vendordir in RbConfig::CONFIG.  Issue #974 by net1957.

 

=== 2.4.0 /2014-07-16

 

Minorenhancements:

 

* The contentscommand now supports a --show-install-dir option that shows

  only the directory the gem is installedin.  Feature request #966 by Akinori

  MUSHA.

* Added a--build-root option to the install command for packagers.  Pull

  request #965 by Marcus Rückert.

* Added vendorgem support to RubyGems.  Packagemanagers may now install gems

  in Gem.vendor_dir with the --vendor option togem install.  Issue #943 by

  Marcus Rückert.

 

Bug fixes:

 

* Kernel#gem nowrespects the prerelease flag when activating gems.

  Previously this behavior was undefined whichcould lead to bugs when a

  prerelease version was unintentionallyactivated.  Bug #938 by Joe Ferris.

* RubyGems nowprefers gems from git over installed gems. This allows gems

  from git to override an installed gem withthe same name and version.  Bug

  #944 by Thomas Kriechbaumer.

* Fixed handlingof git gems in a lockfile with unversioned dependencies.  Bug

  #940 by Michael Kaiser-Nyman.

* The rubydirective in a gem dependencies file is ignored when installing.

  Bug #941 by Michael Kaiser-Nyman.

* Added open tolist of builtin commands (`gem open` now works).  Reported by

  Espen Antonsen.

* `gem open` nowworks with command-line editors.  Pullrequest #962 by Tim

  Pope.

* `gem install-g` now respects `--conservative`.  Pullrequest #950 by Jeremy

  Evans.

* RubyGemsreleases announcements now now include checksums.  Bug #939 by

  Alexander E. Fischer.

* RubyGems nowexpands ~ in $PATH when checking if installed executables will

  be runnable. Pull request #945 by Alex Talker.

* Fixed `geminstall -g --explain`.  Issue #947 byLuis Lavena.  Patch by

  Hsing-Hui Hsu.

* RubyGems locksless during gem activation.  Pull request#951 by Aaron

  Patterson and Justin Searls, #969 by JeremyTryba.

* Kernel#gem isnow thread-safe.  Pull request #967 byAaron Patterson.

* RubyGems nowhandles spaces in directory names for some parts of extension

  building. Pull request #949 by Tristan Hill.

* RubyGems nolonger defines an empty Date class.  PullRequest #948 by Benoit

  Daloze.

* RubyGemsrespects --document options for `gem update` again.  Bug 946 by

  jonforums. Patch by Hsing-Hui Hsu.

* RubyGems generatesdocumentation again with --ignore-dependencies. Bug #961

  by Pulfer.

* RubyGems caninstall extensions across partitions now. Pull request #970 by

  Michael Scherer.

* `-s` is nowshort for `--source` which resolves an ambiguity with

  --no-suggestions.  Pull request #955 by Alexander Kahn.

* Added extratest for ~> for 0.0.X versions.  Pullrequest #958 by Mark

  Lorenz.

* Fixed typo ingem updated help.  Pull request #952 byPer Modin.

* Clarified thatthe gem description should not be excessively long.  Part of

  bug #956 by Renier Morales.

* Hiddocumentation of outdated test_files related methods in Specification.

  Guides issue #90 by Emil Soman.

* RubyGems nowfalls back to the old index if therubygems.org API fails

  during gem resolution.

 

 

 

------------------------------------------------------------------------------

 

RubyGemsinstalled the following executables:

       /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/gem

 

Ruby Interactive(ri) documentation was installed. ri is kind of like man

pages for rubylibraries. You may access it like this:

  ri Classname

  ri Classname.class_method

  ri Classname#instance_method

If you do notwish to install this documentation in the future, use the

--no-documentflag, or set it as the default in your ~/.gemrc file. See

'gem help env'for details.

 

RubyGems systemsoftware updated

 

最后一句说明:Ruby 已经更新。

二、安装cocoapods

这时候再输入命令行:

sudo gem install cocoapods

进行安装cocoapods,输入电脑密码后就会出现如下:

Fetching:i18n-0.6.11.gem (100%)

Successfullyinstalled i18n-0.6.11

Fetching:multi_json-1.10.1.gem (100%)

Successfullyinstalled multi_json-1.10.1

Fetching:activesupport-3.2.19.gem (100%)

Successfullyinstalled activesupport-3.2.19

Fetching:nap-0.8.0.gem (100%)

Successfullyinstalled nap-0.8.0

Fetching: json_pure-1.8.1.gem(100%)

Successfullyinstalled json_pure-1.8.1

Fetching:fuzzy_match-2.0.4.gem (100%)

Successfullyinstalled fuzzy_match-2.0.4

Fetching:cocoapods-core-0.33.1.gem (100%)

Successfullyinstalled cocoapods-core-0.33.1

Fetching:claide-0.6.1.gem (100%)

Successfullyinstalled claide-0.6.1

Fetching:colored-1.2.gem (100%)

Successfullyinstalled colored-1.2

Fetching:xcodeproj-0.17.0.gem (100%)

Building nativeextensions.  This could take a while...

[!] You are usingthe prebuilt binary version of the xcodeproj gem.

Successfullyinstalled xcodeproj-0.17.0

Fetching:cocoapods-downloader-0.6.1.gem (100%)

Successfullyinstalled cocoapods-downloader-0.6.1

Fetching:cocoapods-plugins-0.2.0.gem (100%)

Successfullyinstalled cocoapods-plugins-0.2.0

Fetching:cocoapods-try-0.3.0.gem (100%)

Successfullyinstalled cocoapods-try-0.3.0

Fetching:netrc-0.7.7.gem (100%)

Successfullyinstalled netrc-0.7.7

Fetching:cocoapods-trunk-0.1.4.gem (100%)

Successfullyinstalled cocoapods-trunk-0.1.4

Fetching: escape-0.0.4.gem(100%)

Successfullyinstalled escape-0.0.4

Fetching:open4-1.3.4.gem (100%)

Successfullyinstalled open4-1.3.4

Fetching:cocoapods-0.33.1.gem (100%)

 

CHANGELOG:

 

## 0.33.1

 

##### Bug Fixes

 

* Fix `pod speclint` for `json` podspecs. 

  [Fabio Pelosin][irrationalfab]

 [#2157](https://github.com/CocoaPods/CocoaPods/issues/2157)

 

* Fixeddownloader issues related to `json` podspecs. 

  [Fabio Pelosin][irrationalfab]

 [#2158](https://github.com/CocoaPods/CocoaPods/issues/2158)

 

* Fixed `--no-ansi`flag in help banners. 

  [Fabio Pelosin][irrationalfab]

 [#34](https://github.com/CocoaPods/CLAide/issues/34)

 

Successfullyinstalled cocoapods-0.33.1

Parsingdocumentation for i18n-0.6.11

Installing ridocumentation for i18n-0.6.11

Parsingdocumentation for multi_json-1.10.1

Installing ridocumentation for multi_json-1.10.1

Parsingdocumentation for activesupport-3.2.19

unable to convert"\x80" from ASCII-8BIT to UTF-8 forlib/active_support/values/unicode_tables.dat, skipping

Installing ridocumentation for activesupport-3.2.19

Parsingdocumentation for nap-0.8.0

Installing ridocumentation for nap-0.8.0

Parsingdocumentation for json_pure-1.8.1

Installing ridocumentation for json_pure-1.8.1

Parsingdocumentation for fuzzy_match-2.0.4

Installing ridocumentation for fuzzy_match-2.0.4

Parsingdocumentation for cocoapods-core-0.33.1

Installing ridocumentation for cocoapods-core-0.33.1

Parsingdocumentation for claide-0.6.1

Installing ridocumentation for claide-0.6.1

Parsingdocumentation for colored-1.2

Installing ridocumentation for colored-1.2

Parsingdocumentation for xcodeproj-0.17.0

Installing ridocumentation for xcodeproj-0.17.0

Parsingdocumentation for cocoapods-downloader-0.6.1

Installing ridocumentation for cocoapods-downloader-0.6.1

Parsingdocumentation for cocoapods-plugins-0.2.0

Installing ridocumentation for cocoapods-plugins-0.2.0

Parsingdocumentation for cocoapods-try-0.3.0

Installing ridocumentation for cocoapods-try-0.3.0

Parsingdocumentation for netrc-0.7.7

Installing ri documentationfor netrc-0.7.7

Parsingdocumentation for cocoapods-trunk-0.1.4

Installing ridocumentation for cocoapods-trunk-0.1.4

Parsingdocumentation for escape-0.0.4

Installing ridocumentation for escape-0.0.4

Parsingdocumentation for open4-1.3.4

Installing ridocumentation for open4-1.3.4

Parsingdocumentation for cocoapods-0.33.1

Installing ridocumentation for cocoapods-0.33.1

18 gems installed

 

说明cocopods安装成功了。


三、接下来就是用cocoapods导入第三方类库

导入之前需要先检测一下第三方类库是否支持cocoapods,检测方法AFNetworking举例:

pod search AFNetworking

如下:

Setting upCocoaPods master repo

CocoaPods0.36.0.rc.1 is available.

To update use:gem install cocoapods\n

Setup completed(read-only access)

 

 

->AFNetworking (2.5.1)

   A delightful iOS and OS X networkingframework.

   pod 'AFNetworking', '~> 2.5.1'

   - Homepage:https://github.com/AFNetworking/AFNetworking

   - Source:  https://github.com/AFNetworking/AFNetworking.git

   - Versions: 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]

   - Sub specs:

     - AFNetworking/Serialization (2.5.1)

     -AFNetworking/Security (2.5.1)

     - AFNetworking/Reachability (2.5.1)

     - AFNetworking/NSURLConnection (2.5.1)

     - AFNetworking/NSURLSession (2.5.1)

     - AFNetworking/UIKit (2.5.1)

 

 

->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.1)

   AFNetworking的封装, 并提供一个 UIImageView+DYLoading  cache infileSystem+memory

   pod 'AFNetworking+Ext', '~> 1.1'

   - Homepage:https://github.com/junhaiyang/AFNetworkingExt

   - Source:  https://github.com/junhaiyang/AFNetworkingExt.git

   - Versions: 1.1, 1.0, 0.5, 0.4, 0.3 [masterrepo]

   - Sub specs:

     - AFNetworking+Ext/Base (1.1)

     -AFNetworking+Ext/AFCustomRequestOperation (1.1)

     -AFNetworking+Ext/AFDownloadRequestOperation (1.1)

     - AFNetworking+Ext/AFTextResponseSerializer(1.1)

     - AFNetworking+Ext/example (1.1)

     - AFNetworking+Ext/UIKit (1.1)

     -AFNetworking+Ext/UIKit/UIImageView+DYLoading (1.1)

 

 

->AFNetworking+ImageActivityIndicator (1.0.1)

   AFNetworking+ImageActivityIndicator makes iteasy to show an activity indicator while an image view's

   image is loading using AFNetworking.

   pod 'AFNetworking+ImageActivityIndicator','~> 1.0.1'

   - Homepage:https://github.com/JRG-Developer/AFNetworking-ImageActivityIndicator

   - Source:  https://github.com/JRG-Developer/AFNetworking-ImageActivityIndicator.git

   - Versions: 1.0.1, 1.0.0 [master repo]

 

 

->AFNetworking+SingleBlock (0.0.1)

   Categories that aggregate the success andfailure 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)

   A very quick extension to AFNetworking thatadds stream based parsing

   pod 'AFNetworking+streaming', '~> 0.6'

   - Homepage:https://github.com/deanWombourne/AFNetworking-streaming

   - Source:  https://github.com/deanWombourne/AFNetworking-streaming.git

   - Versions: 0.6, 0.5, 0.4, 0.3, 0.2, 0.1[master repo]

   - Sub specs:

     - AFNetworking+streaming/Core (0.6)

     - AFNetworking+streaming/Json (0.6)

 

 

->AFNetworking-MUResponseSerializer (1.0.1)

   Automatically serialize JSON response toyour 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-RACExtensions (0.1.6)

   AFNetworking-RACExtensions is a delightfulextension to the AFNetworking classes for iOS and Mac OS X.

   pod 'AFNetworking-RACExtensions', '~>0.1.6'

   - Homepage:https://github.com/CodaFi/AFNetworking-RACExtensions

   - Source:  https://github.com/CodaFi/AFNetworking-RACExtensions.git

   - Versions: 0.1.6, 0.1.4, 0.1.2, 0.1.1,0.0.1 [master repo]

 

 

->AFNetworking-RACRetryExtensions (0.1.1)

   AFNetworking-RACRetryExtensions is anextension to the AFNetworking classes for iOS and Mac OS X that

   adds the auto-retry ability.

   pod 'AFNetworking-RACRetryExtensions','~> 0.1.1'

   - Homepage: https://github.com/legoless/AFNetworking-RACRetryExtensions

   - Source:  https://github.com/legoless/AFNetworking-RACRetryExtensions.git

   - Versions: 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]

   - Sub specs:

     - AFNetworking-Synchronous/1.x (0.3.1)

     - AFNetworking-Synchronous/2.x (0.3.1)

 

 

->AFNetworking2-RACExtensions (0.0.1)

   AFNetworking-RACExtensions is a delightfulextension 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 AFNetworkinglibrary.

   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.1)

   CollectionUtils additions for AFNetworking.

   pod 'CollectionUtils-AFNetworking', '~>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]

 

 

->CollectionUtils-AFNetworking-1.3 (1.0.1)

   CollectionUtils additions for AFNetworking1.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.3.1)

   Configurator for using AFNetworking withMantle

   pod 'HYVConfiguratorAFNetworking-Mantle','~> 0.3.1'

   - Homepage:https://github.com/LilushFess/HYVConfiguratorAFNetworking-Mantle.git

   - Source:  https://github.com/LilushFess/HYVConfiguratorAFNetworking-Mantle.git

   - Versions: 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 todownload 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]

 

 

->PromiseKit-AFNetworking (0.1.5)

   PromiseKit extensions for AFNetworking

   pod 'PromiseKit-AFNetworking', '~> 0.1.5'

   - Homepage:https://github.com/csotiriou/AFNetworking-PromiseKit/

   - Source:  https://github.com/csotiriou/AFNetworking-PromiseKit.git

   - Versions:0.1.5, 0.1.4, 0.1.3, 0.1.2, 0.1.1 [master repo]

 

会出现很多与AFNetworking相关的类库。这就说明AFNetworking是支持cocopods的。


四、检测第三方类库支持cocoapos之后,用cocoapods下载并导入该库。

按照文档创建一新poject

CocoaPodsDemo


至于CocoaPods为什么能下载AFNetworking,是因为有个名称为Podfile的文件来控制CocoaPods该下载什么(注意,一定得是这个文件名,而且没有后缀)。你创建一个Podfile文件,然后在里面添加你需要下载的类库,也就是告诉CocoaPods,可以下载这个。每个项目只需要一个Podfile文件。

在终端输入命令:

cd .xcodeproj所在路径,先找到工程文件所在文件夹,

再输入:

vim podfile

创建podfile文件

在终端会出现

~

~

~

~

~

~

~

podfile[New File]

输入命令i,变为可输入模式

会变成

~

~

~

~

---------------INSERT---------------

接着可以输入:

platform :ios, '7.0'

pod"AFNetworking", "~> 2.0"


输入完成后为

platform :ios, '7.0'

pod"AFNetworking", "~> 2.0"

~

~

~

~

---------------INSERT---------------

此时先点击键盘上“Esc(退出键)”退出输入模式,在终端底部输入:wq就可以退出并保存了,此时在项目所在文件夹可以看到podfile文件

如图:


双击podfile如图:


说明已经将“需要安装AFNetworking”告知给cocoa pods,此时在终端输入命令行:

pod install

如下:

Analyzingdependencies

 

CocoaPods0.36.0.rc.1 is available.

To update use:gem install cocoapods\n

Downloadingdependencies

InstallingAFNetworking (2.5.1)

Generating Podsproject

Integratingclient project

 

[!] From now onuse `CocoaPodsDemo.xcworkspace`.


说明安装成功,最后一句说明,从现在开始需要双击`CocoaPodsDemo.xcworkspace`.来打开项目,而并非.xcodeproj

安装完之后项目文件夹里会多出两个文件如图:


双击.workspace如图:




如图说明AFNetworking已经成功导入项目中,这时可以在适当地方导入头文件

#import <AFNetworking.h>

编译应该不会报错,所以感谢原文帮忙解决下载、导入、以及配置第三方类库的问题,省去很多麻烦可以更好管理第三方类库。


四、在已有运行已有podfile文件的项目,中关于库更新问题

如果运行下载的项目报错的话,

打开终端cd找到项目所在路径,输入命令行进行更新第三方库的操作:

pod update

更新之后再执行:

pod install

成功之后双击.workspace就可以运行项目了。








本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MAC 安装cocoapods 的相关文章

随机推荐

  • nginx 配置https 并兼容http 或强制http 转为https

    当我们升级http 为https时 xff0c 为了兼顾一些访问者还是通过http访问的方式 xff0c 我们通常采用两种方式 第一种 xff1a http 可以访问 xff0c https也可以访问 第二种 xff1a http 访问时
  • 滤波学习理解----EKF(一)

    最近回到slam方向了 xff0c 所以有时间整理一下最近的收获 最复杂也是最简单的模块 滤波 引入 那么滤波是什么呢 xff1f 滤波就是由于观测observation xff08 OB xff09 天生具备的误差和噪声 当有多个信号源观
  • systemd开机启动和关机回调脚本

    一 开机执行一次的脚本 我们通过可以创建一个 etc rc local文件 xff1a etc rc local文件内容如下 xff1a span class token operator span span class token ope
  • (五)Selenium自动化测试实战—PO模式

    nbsp 上一篇 四 selenium自动化测试之上传本地文件 要开朗的spookypop的博客 CSDN博客 selenium上传本地文件 先看下测试代码运行效果 在做自动化测试时 测试框架设计很重要 测试代码写法也很多种 最简单的莫过于
  • 网络隧道技术

    隧道技术摘要 隧道技术 xff08 Tunneling xff09 是网络基础设置在网络之间传递数据的方式 xff0c 使用隧道技术传递可以是不同协议的数据包 xff0c 隧道协议将这些其他协议的数据包重新封装在新的包头中发送 被封装的数据
  • 数据库的备份和还原

    数据库的备份和还原是一个很重要的问题 xff0c 有时候我们一个误删可能数据库里的数据就都没有了 xff0c 所以一定要做好备份的工作 备份 1 右击 任务 备份 2 选择要备份的数据库 xff0c 和备份的类型 完整 xff0c 添加 3
  • 海信A6/A6L A7Pro/CC A5PRO/A5PRO CC 安装gms google service指南

    用过海信双面屏或者eink手机的朋友都知道 xff0c 海信手机就是死活安装不了谷歌全家桶 xff0c 因为海信的领导说跟谷歌有协议不能安装谷歌框架 xff08 还说后期google审核坚决不给安装 xff0c 人家其他ov mui都可以安
  • Windows Terminal无法加载WSL [process exited with code 4294967295 (0xffffffff)]

    在Windows Terminal中WSL无法打开错误代码是 process exited with code 4294967295 0xffffffff xff0c 但在命令行中 通过 34 C Windows System32 wsl
  • 【经验分享】PC端免费高效的同声翻译

    2022 09 26 谷歌翻译退出中国市场 translate googleapis com 与 谷歌翻译web translate google cn现在无法用了 最新解决方法见 https blog csdn net sinat 240
  • 巧用Prometheus来扩展kubernetes调度器

    Overview 本文将深入讲解 如何扩展 Kubernetes scheduler 中各个扩展点如何使用 xff0c 与扩展scheduler的原理 xff0c 这些是作为扩展 scheduler 的所需的知识点 最后会完成一个实验 xf
  • 【C】目录

    ch0 idech01 变量和数据结构ch02 格式化与流程控制ch03 数组ch04 函数ch05 指针ch06 关于C语言的内存布局ch07 复合结构ch08 文件处理
  • 协议数据单元 帧 包 段 报文之间的区别

    Overview 1 协议数据单元 Protocol Data Unit PDU 是应用于OSI模型中的数据结构 xff0c 在OSI模型中每一层都会被添加一个header xff0c tailer进行封装 xff0c header tai
  • 官方摆烂这就是haproxy所谓的云原生架构

    只支持 systemd 这种方式管理 xff0c 其他方式重启失败 xff0c 搜索关键字 xff0c 17个相关问题并未有良好的解决方法 使用master worker方式管理 xff0c data plane api 重启不能拉起hap
  • 【github开源】Linux iptables 界面化 分布式 管理平台 go vue,底座firewalld

    快速部署 xff1a Uranus 目前最优的firewalld前端 如果你觉得项目符合你的使用场景 劳烦大佬点个 x1f31f x1f31f x1f31f 吧 好人一生平安 Uranus Gateway Uranus使命是将iptable
  • iOS真机调试报错(0xE8008016)相关错误

    经常真机运行时候会报错 xff0c 原因之一是之前对项目进行过打包进行如下设置 将Edit Scheme gt Run gt Build Configuration 设置为Release 将其勾选为 Debug状态 xff0c 接下来继续运
  • 支付宝快捷登录相关事宜

    接近年关 xff0c 公司产品提出新需求 xff0c 和支付宝合作 xff0c 需要开发快捷登录 无线账户授权 xff0c 手机端装有支付宝钱包 xff0c 直接唤起支付宝钱包 xff0c 若没有支付宝钱包就直接走HTML5页面操作 xff
  • 将DataGridview中的数据存入数据库

    在机房收费的时候我们都会用到DataGridView控件 xff0c 用来显示从数据库中返回的数据 如何用DataGridView将数据存入到数据库 xff0c 而且是存入到字段与数据库中不一致的表中呢 xff1f 前提介绍 为了将如下的1
  • mac系统Tunnelblick 下载以及安装流程

    公司有些网站有权限设置 xff0c 不同的域账号权限不一样 xff0c 因此需在电脑上安装Tunnelblick xff0c 才能使用 xff0c 接下来给大家介绍一下步骤 xff1a 首先要有安装vpn对应的一系列配置文件 xff1a c
  • IOS App提交到appStore Missing 64-bit support

    Dear developer We have discovered one or more issues with your recent delivery for 34 就医宝 34 Your delivery was successfu
  • MAC 安装cocoapods

    首先是看了文章 xff1a http code4app com article cocoapods install usage http www uml org cn mobiledev 201411072 asp 一 检测以及配置Ruby