Pod is inside the wall

Time is precious Long story short.
CocoaPods is a tool responsible for managing third-party open source code in iOS projects. If you haven't heard of it and don't want to use it, then don't read further.

1. The installation of CocoaPods
requires ruby. The Mac system comes with ruby, but if it is not the latest system, it is best to update it.
Ruby’s software source rubygems.org is blocked, so change the source first, and execute 3 commands in the command line
$ gem sources --remove  https://rubygems.org/
$ gem sources -a  http://ruby.taobao.org/
$ gem sources -l

Then upgrade the gem
$ sudo gem update --system

and start installing CocoaPods
$ sudo gem install cocoapods
$ pod set Up

appears Setting up CocoaPods master repo, and there is no response for a long time. For no other reason than that wall blocking cocoapods.org. . .
Both gitcafe and oschina are domestic servers, and you can use the mirror image of their CocoaPods index library:
$ pod repo remove master
$ pod repo add master  https://gitcafe.com/akuandev/Specs.git
$ pod repo update
 If you want to use the image of oschina, you can also replace the second command with  http://git.oschina.net/akuandev/Specs.git . It will take time to execute the second command. At this time, you need to clone the entire specs warehouse and download it to ~/.cocoapods; cd to this directory and use the du -sh * command to check the file size. Check it every once in a while, and the final size is more than 190 M. 2. Use of CocoaPods (1) In the terminal shell, cd to the project you want to manage, run: pod install Your project will have an additional xworkspace folder, and use this to open the project later (2) Add a third-party library to search for an open source library $ pod search AFNetworking Create a Podfile file in the project directory $ vim Podfile content according to this format platform :ios,'6.0' pod 'RegexKitLite', '~> 4.0' pod 'ASIHTTPRequest', '~> 1.8.2' pod 'SDWebImage', '~> 3.7.1' pod 'FMDB', '~> 2.3' More references: CocoaPods, an Objective- C third - party library management tool CocoaPods Advanced : Local Package Management 3 .






























(1)最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing dependencies不动 原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,命令如下: pod install --verbose --no-repo-update pod update --verbose --no-repo-update
$ pod install只会按照Podfile的要求来请求类库,如果类库版本号有变化,那么将获取失败。但是 $ pod update会更新所有的类库,获取最新版本的类库。每次用$ pod update就行。

(2)安装一个xcode插件管理工具   http://alcatraz.io ,执行curl -fsSL  https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh  | sh  完了打开xcode->window->package manger 搜cocoapods安装,方便操作。


(3)工程在模拟器上编译报错,不支持i386,Cocoapods确实还不支持64位模拟器,解决办法:
http://stackoverflow.com/questions/19213782/undefined-symbols-for-architecture-arm64
其实就2条,1.build active architecture only 在debug的时候设置成YES,不要在release的时候用模拟器    2.other linker flags 加一个 $(inherited)

(4)用到svn,git多人协作的话,Pods/这个文件夹不要上传,.../Pods/Pods.xcodeproj  ...Pods/Target Support Files/这些每次编译都会改动从而引起合并代码的时候冲突

更多坑可以看wiki,例如   https://github.com/CocoaPods/CocoaPods/issues/2190
其他坑各位可以补充。。。

Guess you like

Origin blog.csdn.net/sirodeng/article/details/50685228