求助.cocoapod的安装

Python019

求助.cocoapod的安装,第1张

iOS 最新版 CocoaPods 的安装流程

1.移除现有Ruby默认源

$gem sources --remove https://rubygems.org/

2.使用新的源

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

3.验证新源是否替换成功

$gem sources -l

4.安装CocoaPods

(1) $sudo gem install cocoapods 备注:苹果系统升级 OS X EL Capitan 后改为$sudo gem install -n /usr/local/bin cocoapods

(2) $pod setup

5.更新gem

$sudo gem update --system

6. 新建工程,并在终端用cd指令到文件夹内

$pod search 第三方

7.新建文件 vim “Podfile”,

$vim Podfile

写入以下内容并保存 小提示:(终端vim文件 按 i 可编辑 ,esc 退出编辑,:wq 可保存退出)

platform:ios, '6.0'

pod 'AFNetworking', '~>2.3.1'<-------第三方

8.导入第三方库

$pod install

9.退出终端

以下是我用以前的安装流程安装时出现的一些错误

终端 cocoapods 下载bug调试:

错误1:

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

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

解决方案:把安装流程中 $gem sources -a http://ruby.taobao.org/ ---改为---->$gem sources -a https://ruby.taobao.org/

错误2:

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

Operation not permitted - /usr/bin/pod

解决方案:苹果系统升级OS X EL Capitan后会出现的插件错误,将安装流程 4.安装CocoaPods 的 (1)sudo gem install cocoapods ——>改为sudo gem install -n /usr/local/bin cocoapods

错误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.

解决方案:安装流程:Podfile文件 中 platform:ios, ‘6.0’ 后边的 6.0 是平台版本号 ,一定要加上

如题,使用xcode9.3后新建工程,然后初始化pod init,结果报错:

报错信息

pod init

――― MARKDOWN TEMPLATE ――――――

### Command

```

/usr/local/bin/pod init

```

### Report

* What did you do?

* What did you expect to happen?

* What happened instead?

### Stack

```

   CocoaPods : 1.3.1

        Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]

    RubyGems : 2.6.14

        Host : Mac OS X 10.13.4 (17E202)

       Xcode : 9.3 (9E145)

         Git : git version 2.15.1 (Apple Git-101)

Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib

Repositories : master - https://github.com/CocoaPods/Specs.git @ 8e9a8f04aa2579345661be7afc6f6fafdfb09d51

               PrivatePods - https://github.com/ModulizationDemo/PrivatePods.git @ 22ad9a433c6e02afeef4d32da95ba0fe64799a0d

```

### Plugins

```

cocoapods-deintegrate : 1.0.1

cocoapods-plugins    : 1.0.0

cocoapods-search      : 1.0.0

cocoapods-stats      : 1.0.0

cocoapods-trunk      : 1.3.0

cocoapods-try        : 1.1.0

```

### Error

```

RuntimeError - [Xcodeproj] Unknown object version.

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:217:in `initialize_from_file'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:102:in `open'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command/init.rb:41:in `validate!'

/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:333:in `run'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/bin/pod:55:in `'

/usr/local/bin/pod:23:in `load'

/usr/local/bin/pod:23:in `'

```

――― TEMPLATE END ―――

'''

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:

https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+Unknown+object+version.&type=Issues

If none exists, create a ticket, with the template displayed above, on:

https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:

https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...

 - RuntimeError - [Xcodeproj] Unknown object version.