1.無(wú)論是執(zhí)行pod install還是pod update都卡在了Analyzing dependencies 或者 Updating local specs repositories不動(dòng)
解決: 原因在于當(dāng)執(zhí)行以上兩個(gè)命令的時(shí)候會(huì)升級(jí)CocoaPods的spec倉(cāng)庫(kù)蠢护,加一個(gè)參數(shù)可以省略這一步瘦馍,然后速度就會(huì)提升不少。加參數(shù)的命令如下:
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
2.pod 命令運(yùn)行報(bào)下面錯(cuò)誤
Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
解決: 不要使用文本編輯去編輯Podfile穿香,使用Xcode編輯煮嫌,或者使用終端敲命令去編輯器净〖馓裕或者輸入格式錯(cuò)誤惫叛,沒(méi)輸入運(yùn)行版本:
platform:iOS, '7.0'
3.使用cocoapods導(dǎo)入第三方類庫(kù)后頭文件沒(méi)有代碼提示
解決: 選擇Target -> Build Settings 菜單倡勇,找到\”User Header Search Paths\”設(shè)置項(xiàng),新增一個(gè)值"${SRCROOT}"嘉涌,并且選擇\”Recursive\”
4.The dependency “ is not used in any concrete target.
解決: 這個(gè)錯(cuò)誤是說(shuō)明你沒(méi)有使用下面的格式, 將 Podfile編輯成下面的格式
platform :ios,'7.0'
target '你的app的target名字' do
pod 'AFNetworking', '2.0'
pod 'SDWebImage', '3.7'
...
end
5.安裝錯(cuò)誤
Setting up CocoaPods master repo [!] /usr/bin/git clone [https://github.com/CocoaPods/Specs.git](https://github.com/CocoaPods/Specs.git) master –depth=1 Cloning into ‘master’… error: RPC failed; result=18, HTTP code = 200 fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
解決:
$ git config --global http.postBuffer 24288000
$ git config --list
若輸出 http.postbuffer=24288000, 就 OK了
6.在 pod install 時(shí), 可以生成要導(dǎo)入的第三庫(kù), 但是其頭文件找不到, 文件有缺失, target 設(shè)置沒(méi)有完成.
[!] The `Paopao [Debug]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Release]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
解決: 產(chǎn)生此警告的原因是項(xiàng)目 Target 中的一些設(shè)置妻熊,CocoaPods 也做了默認(rèn)的設(shè)置,如果兩個(gè)設(shè)置結(jié)果不一致仑最,就會(huì)造成問(wèn)題扔役。
我想要使用 CocoaPods 中的設(shè)置,分別在我的項(xiàng)目中定義PODS_ROOT 和 Other Linker Flags的地方词身,把他們的值用$(inherited)替換掉厅目,進(jìn)入終端,執(zhí)行 pod update , 然后錯(cuò)誤沒(méi)了.
還有一種簡(jiǎn)單粗暴的方法:
點(diǎn)擊項(xiàng)目文件 project.xcodeproj法严,右鍵顯示包內(nèi)容损敷,用文本編輯器打開(kāi)project.pbxproj,刪除OTHER_LDFLAGS的地方深啤,保存拗馒,執(zhí)行pod update,錯(cuò)誤沒(méi)了
7.引用要導(dǎo)入的三方庫(kù)缺少 .o 文件的錯(cuò)誤
解決: 在Build Setting 中的Other Linker Flags選項(xiàng)中加入$(OTHER_LDFLAGS)
8.還有一個(gè)復(fù)雜些的錯(cuò)誤, 在為新項(xiàng)目配置 cocoapods 時(shí)遇到的
LoadError - dlopen(/Users/MyMac/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/x86_64-darwin14.1.0/psych.bundle, 9): Library not loaded: /usr/local/lib/libyaml-0.2.dylib
Referenced from: /Users/MyMac/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/x86_64-darwin14.1.0/psych.bundle
Reason: image not found - /Users/MyMac/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/x86_64-darwin14.1.0/psych.bundle
9.Mac OS X 跟新到10.11后cocoapods安裝出現(xiàn)的問(wèn)題
$ sudo gem install cocoapods ERROR: Could not find a valid gem ‘cocoapods’ (>= 0), here is why: Unable to download data from [http://ruby.taobao.org/](http://ruby.taobao.org/) - bad response Not Found 404 ([http://ruby.taobao.org/latest_specs.4.8.gz](http://ruby.taobao.org/latest_specs.4.8.gz))
更新ruby后也沒(méi)有解決, 最后發(fā)現(xiàn)是由于淘寶鏡像失效了,http://ruby.taobao.org/失效了 解決方案有兩個(gè): 1>將淘寶鏡像的http改為https
$ gem sources --remove http://ruby.taobao.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
再安裝就可以了
sudo gem install cocoapods
2>后來(lái)在stackoverflow上看到一個(gè)回答 是關(guān)于gem install fails with openssl failure,將淘寶鏡像替換為http://rubygems.org/.
$ gem source -a http://rubygems.org/
再安裝就可以了
$ sudo gem install cocoapods
10.ruby環(huán)境需要升級(jí)更新 ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
原因:在安裝cocoapods過(guò)程中提示需要Ruby的版本在2.2.2以上,而目前使用的Ruby版本是Mac系統(tǒng)自帶的1.8.7溯街。所以需要對(duì)Ruby進(jìn)行升級(jí)诱桂。以下是安裝Ruby的三種方法: 1.下載ruby源代碼,編譯呈昔,安裝 2.使用發(fā)行版自帶的安裝包挥等,安裝 3.使用 rvm安裝 在這里還是推薦大家通過(guò)rvm對(duì)Ruby進(jìn)行升級(jí),具體的步驟這里就不贅述了, 需要的請(qǐng)查看我的博客之 cocoapods:安裝/更新Ruby環(huán)境教程, 里面有通過(guò)ram安裝ruby的具體操作.
11.pod setup/ pod install 錯(cuò)誤總結(jié)
問(wèn)題1:
$ pod install
Analyzing dependencies
[!] Unable to satisfy the following requirements:
-AFNetworking (~> 3.0) required by Podfile
None of your spec sources contain a spec satisfying the dependency: AFNetworking (~> 3.0).
You have either:
* out-of-date source repos which you can update with pod repo update.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.
解決:
$ pod repo remove master
$ pod repo add master https://gitcafe.com/akuandev/Specs.git
$ pod repo update
問(wèn)題2:
$ pod setup Setting up CocoaPods master repo [!] /usr/bin/git clone [https://github.com/CocoaPods/Specs.git](https://github.com/CocoaPods/Specs.git) master Cloning into ‘master’… error: RPC failed; curl 56 SSLRead() return error -36 fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
解決:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
并一定是這行代碼堤尾,要根據(jù)自己的情況肝劲,來(lái)修改這個(gè)命令行, 也許你是多個(gè)xcode, 那么你的命令行就要修改一下:
$ sudo xcode-select -switch /Applications/Xcode 7.3.1.app/Contents/Developer
問(wèn)題3:
$ pod setup Setting up CocoaPods master repo [!] /usr/bin/git clone [https://github.com/CocoaPods/Specs.git](https://github.com/CocoaPods/Specs.git) master Cloning into ‘master’… error: RPC failed; curl 56 SSLRead() return error -9806 fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
問(wèn)題4:
$ pod setup Setting up CocoaPods master repo [!] /usr/bin/git clone [https://github.com/CocoaPods/Specs.git](https://github.com/CocoaPods/Specs.git) master Cloning into ‘master’… error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
這些怎么解決呢? 其實(shí)mac OS 10.11之后, cocoapods的一些命令需要進(jìn)行變化,今天來(lái)總結(jié)一下. 如果你遇到了pod setup或者pod update 的問(wèn)題了, 而且很難解決, 我建議不如卸載重裝. 10.11 之后, 安裝cocoapods有一些不同的命令,下面總結(jié)一下:
1.檢查ruby環(huán)境,若需要請(qǐng)按如下更新
$ sudo gem update --system
2.卸載cocoapods
$ sudo gem uninstall cocoapods
3.重裝cocoapods (安裝命令有變化)
10.11之前
$ sudo gem install cocoapods
10.11之后
$ sudo gem install -n /usr/local/bin cocoa pods
$ sudo chmod +rx /usr/local/bin
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
//將 CocoaPods Specs repository復(fù)制到你電腦上~/.cocoapods目錄下
pod setup
原文引自 http://blog.csdn.net/wangyanchang21/article/details/51437934