Installation of CocoaPods

  • Remove existing Ruby default sources
$ gem sources --remove https://rubygems.org/
  • use new source
$ gem sources -a https://ruby.taobao.org/
  • Verify that the new source is replaced successfully
$ gem sources -l
  • Install CocoaPods

    • $ sudo gem install cocoapods

    Note: After the Apple system upgrades OS X EL Capitan to

    $sudo gem install -n /usr/local/bin cocoapods

    • $ pod setup
  • update gems

$ sudo gem update --system
  • Create a new project and use the cd command in the terminal to go to the folder
$ pod search 第三方
  • create a new filevim Podfile
$ vim Podfile

Write the following content and save the tips: (Press i to edit the vim file in the terminal, esc to exit editing, :wq to save and exit)

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
inhibit_all_warnings!
use_frameworks!

target 'prj' do
    pod 'AFNetworking', '~>3.1'
end
  • Import third-party libraries
$ pod install
  • exit terminal

Here are some errors I get when installing with the previous installation process

Terminal cocoapodsdownload bugdebugging:

Error 1:

Error fetching http://ruby.taobao.org/:

bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)

Solution: Put the installation process in

$gem sources -a http://ruby.taobao.org/ 改为 $gem sources -a https://ruby.taobao.org/

Error 2:

ERROR:  While executing gem ... (Errno::EPERM)

Operation not permitted - /usr/bin/pod

Solution: Plug-in error that occurs after the Apple system upgrades OS X EL Capitan

sudo gem install cocoapods 改为 sudo gem install -n /usr/local/bin cocoapods

Error 3:

[!] Unable to satisfy the following requirements: - `AVOSCloud (~> 3.1.6.3)` required by `Podfile`

Specs satisfying the `AVOSCloud (~> 3.1.6.3)` dependency were found, but they required a higher minimum deployment target.

Solution: The 6.0 at the back of the Podfilefile is the platform version number, be sure to add itplatform:ios, '6.0'

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325504338&siteId=291194637