cocoapods 更新

 

MacOS High Sierra 中 cocoapods 不能使用

mac 升级到10.11以后会出现cocoapods不能使用的情况,特别是pod init 出现错误下面简单的介绍解决方法:

在osx 10.11之前cocopods问题不多,但是升级到11之后的版本,之前的cocopods大多用不了,需要重新安装:

1.出现以下问题,大家不要慌:

1 boai:~ boai$ sudo gem install cocoapods
2 ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
3           Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
4 boai:~ boai$ sudo gem install cocoapods 
5 ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
6           Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
7 boai:~ boai$ sudo gem update --system
8 ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
9     bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)

1)先执行下面两行代码:

1 sudo gem sources -r https://rubygems.org

2 sudo gem sources -a http://rubygems.org 

(2)执行过程如下:

1 boai:~ boai$ sudo gem sources -r https://rubygems.org
2 source https://rubygems.org not present in cache
3 boai:~ boai$ sudo gem sources -a http://rubygems.org
4 https://rubygems.org is recommended for security over http://rubygems.org
5 
6 Do you want to add this insecure source? [yn]  y

最后会提示

Do you want to add this insecure source? [yn]  
你选择 y就行了
然后出现:
http://rubygems.org added to sources
这就说明成功了,就可以执行下面的安装了。
2.安装cocopods

执行下面的语句:

1 :sudo gem install cocoapods

会出现下面的界面:

boai:~ boai$ sudo gem install cocoapods
Fetching: nap-1.0.0.gem (100%)
Successfully installed nap-1.0.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: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.5.gem (100%)
Successfully installed activesupport-4.2.5
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: molinillo-0.4.0.gem (100%)
Successfully installed molinillo-0.4.0
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: cocoapods-try-0.5.1.gem (100%)
Successfully installed cocoapods-try-0.5.1
Fetching: cocoapods-stats-0.6.2.gem (100%)
Successfully installed cocoapods-stats-0.6.2
Fetching: cocoapods-search-0.1.0.gem (100%)
Successfully installed cocoapods-search-0.1.0
Fetching: cocoapods-plugins-0.4.2.gem (100%)
Successfully installed cocoapods-plugins-0.4.2
Fetching: cocoapods-downloader-0.9.3.gem (100%)
Successfully installed cocoapods-downloader-0.9.3
Fetching: claide-0.9.1.gem (100%)
Successfully installed claide-0.9.1
Fetching: xcodeproj-0.28.2.gem (100%)
Successfully installed xcodeproj-0.28.2
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: cocoapods-0.39.0.gem (100%)
Successfully installed cocoapods-0.39.0
Parsing documentation for nap-1.0.0
Installing ri documentation for nap-1.0.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 i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for activesupport-4.2.5
Installing ri documentation for activesupport-4.2.5
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for molinillo-0.4.0
Installing ri documentation for molinillo-0.4.0
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 cocoapods-try-0.5.1
Installing ri documentation for cocoapods-try-0.5.1
Parsing documentation for cocoapods-stats-0.6.2
Installing ri documentation for cocoapods-stats-0.6.2
Parsing documentation for cocoapods-search-0.1.0
Installing ri documentation for cocoapods-search-0.1.0
Parsing documentation for cocoapods-plugins-0.4.2
Installing ri documentation for cocoapods-plugins-0.4.2
Parsing documentation for cocoapods-downloader-0.9.3
Installing ri documentation for cocoapods-downloader-0.9.3
Parsing documentation for claide-0.9.1
Installing ri documentation for claide-0.9.1
Parsing documentation for xcodeproj-0.28.2
Installing ri documentation for xcodeproj-0.28.2
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 cocoapods-0.39.0
Installing ri documentation for cocoapods-0.39.0
Done installing documentation for nap, thread_safe, tzinfo, i18n, activesupport, escape, colored, molinillo, netrc, cocoapods-trunk, cocoapods-try, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, claide, xcodeproj, fuzzy_match, cocoapods-core, cocoapods after 21 seconds
WARNING:  Unable to pull data from 'http://ruby.taobao.org/': bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
20 gems installed

然后就可以查看你的pods版本了:

输入:pod

然后会出现下面的代码:

boai:~ boai$ pod
Usage:

    $ pod COMMAND

      CocoaPods, the Cocoa library package manager.

Commands:

    + cache      Manipulate the CocoaPods cache
    + init       Generate a Podfile for the current directory.
    + install    Install project dependencies to Podfile.lock versions
    + ipc        Inter-process communication
    + lib        Develop pods
    + list       List pods
    + outdated   Show outdated project dependencies
    + plugins    Show available CocoaPods plugins
    + repo       Manage spec-repositories
    + search     Search for pods.
    + setup      Setup the CocoaPods environment
    + spec       Manage pod specs
    + trunk      Interact with the CocoaPods API (e.g. publishing new specs)
    + try        Try a Pod!
    + update     Update outdated project dependencies and create new
                 Podfile.lock

Options:

    --silent     Show nothing
    --version    Show the version of the tool
    --verbose    Show more debugging information
    --no-ansi    Show output without ANSI codes
    --help       Show help banner of specified command
boai:~ boai$ 

这就安装成功了,就可以正常使用pod了。。。

4、接下来就可以在项目中使用了,

打开终端:

cd 你的项目路径

boai:~ boai$ cd /Users/boai/Documents/博爱项目/BAPDCViewTest 
然后:输入touch podfile  或者 pod init (会自动生成podfile文件)

boai: boai$ pod init

boai: boai$ pod install
然后出现:
Last login: Fri Nov 20 11:02:59 on ttys006 boai:~ boai$ cd /Users/boai/Documents/博爱项目/BAPDCViewTest boai:BAPDCViewTest boai$ touch podfile boai:BAPDCViewTest boai$ pod install Updating local specs repositories Analyzing dependencies Downloading dependencies Generating Pods project Integrating client project [!] Please close any current Xcode sessions and use `BAPDCViewTest.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. boai:BAPDCViewTest boai$
这就成功了,然后再看看你的项目路径里面,是不是多出来很多文件?

文章借鉴:https://www.cnblogs.com/sunfuyou/p/6877217.html

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值