2018 年 cocoapod的安装

已经安装了cocoapod环境的情况下创建cocoapod的工程项目

1.cd 到项目目录中

2.执行命令 touch Podfile

3.编辑Podfile ,执行命令vim Podfile

在Podfile中



platform :ios, '8.0'

target 'sfyTest' do

 pod 'IQKeyboardManager' 

 pod 'MJExtension'

 pod 'Masonry'

 pod 'TTTAttributedLabel' 

 pod 'FMDB' 

pod 'AFNetworking', '~> 3.1.0'

pod 'MJRefresh'

pod 'ShareSDK3','~> 3.4.2' 

pod 'MOBFoundation', '~> 2.0.11'

pod'ShareSDK3/ShareSDKUI'

pod 'ShareSDK3/ShareSDKPlatforms/QQ'

pod 'ShareSDK3/ShareSDKPlatforms/WeChat'

pod 'UMengAnalytics-NO-IDFA', '~> 4.1.9'

pod 'SDWebImage', '~> 3.8.2'

pod 'SDCAlertView', '2.5.2'

end



4、执行命令pod install(这个过程比较漫长,慢慢等待)!

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

```

/usr/local/bin/pod install

```

### 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 (17E199)

       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 @ 95ccb1149b36337a5dc9303b23112201b5750ae4

```

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

```

### Podfile

```ruby

platform :ios,'8.0'

target 'sfyTest' do

pod 'IQKeyboardManager' 

pod 'MJExtension'

pod 'Masonry'

pod 'AFNetworking', '~> 3.1.0'

pod 'MJRefresh'

pod 'SDWebImage', '~> 3.8.2'

pod 'SDCAlertView', '2.5.2'

end

```

### Error

```

RuntimeError - [Xcodeproj] Unknown object version.

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

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

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:903:in `block (2 levels) in inspect_targets_to_integrate'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:902:in `each'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:902:in `block in inspect_targets_to_integrate'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in `section'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:897:in `inspect_targets_to_integrate'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:69:in `analyze'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:242:in `analyze'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in `section'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:153:in `resolve_dependencies'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:116:in `install!'

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

/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334: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.

   https://github.com/CocoaPods/CocoaPods/issues/7697 [closed] [16 comments]

   2 days ago

 - RuntimeError - [Xcodeproj] Unknown object version.

   https://github.com/CocoaPods/CocoaPods/issues/7712 [closed] [9 comments]

   2 weeks ago

 - Unknown object version

   https://github.com/CocoaPods/CocoaPods/issues/7760 [closed] [1 comment]

   a day ago

and 38 more at:

https://github.com/cocoapods/cocoapods/search?q=[Xcodeproj]%20Unknown%20object%20version.&type=Issues&utf8=✓

错误提示,怎么办呢


输入

5、终端输入sudo gem install -n /usr/local/bin cocoapods

如图:

2018 年 cocoapod的安装_第1张图片


6.终端输入pod setup

如图


2018 年 cocoapod的安装_第2张图片

然后cd 到显目目录下 

终端输入pod install



2018 年 cocoapod的安装_第3张图片

完成了!

你可能感兴趣的:(2018 年 cocoapod的安装)