使用CocoaPods遇到的幾個坑,記錄一下

最近使用pod的時候升級到1.0.0版本後遇到一些坑,整理一下html

首先是CocoaPods報錯:The dependency `` is not used in any concrete target

錯誤內容ios

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /Applications/Cocos/tools/ant/bin in PATH, mode 040777 Re-creating CocoaPods due to major version update. Updating local specs repositories Analyzing dependenciesgit

[!] The dependency `ReactiveCocoa (= 2.1.8)` is not used in any concrete target. github

The dependency `objectiveflickr (= 2.0.4)` is not used in any concrete target.xcode

The dependency `LinqToObjectiveC (= 2.0.0)` is not used in any concrete target. ruby

The dependency `SDWebImage (= 3.6)` is not used in any concrete target.app

查了查好像是配置podfile文件的問題curl

做以下修改ui

platform :ios, ‘7.0‘

target "RWTFlickrSearch" do
pod ‘ReactiveCocoa‘, ‘2.1.8‘
pod ‘objectiveflickr‘, ‘2.0.4‘
pod ‘LinqToObjectiveC‘, ‘2.0.0‘
pod ‘SDWebImage‘, ‘3.6‘
end

這樣再運行pod install,就會成功了。url

緣由是podfile升級到最新版本,pod裏的內容必須明確指出所用第三方庫的target

遇到這個問題時,首先打算的是從新安裝,結果又遇到坑,發現報錯以下:

ERROR:  Could not find a valid gem 'cocospods’ (>= 0), here is why:

          Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/latest_specs.4.8.gz)

查了查發現須要將http 替換成 https

做以下修改:

1.gem sources --remove http://ruby.taobao.org/

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

3.查看源對不對

  gem sources -l

4.再安裝就行了

  sudo gem install cocoapods

而後又遇到坑,報這個錯:

 

  ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj
後來使用這個指令解決了
sudo gem install -n /usr/local/bin cocoapods

 

 

因爲我一直使用的是 pod update --verbose --no-repo-update 和 pod install --verbose --no-repo-update 這兩條指令,
因此會忽略升級CocoaPods的spec倉庫

而後我又去 pod install 和 pod update 了下終於能用了。




期間還卸載從新安裝了下使用以下指令
1. 卸載cocoapods$ sudo gem uninstall cocoapods
2. 安裝xcodeproj$ sudo gem install xcodeproj
3. 安裝指定版本的Cocoapods$ sudo gem install cocoapods -v 0.39.0

安裝成功以後又遇到問題了

1. $

2016-10-8更新

 遇到一個安裝路徑的問題使用以下指令解決

$ sudo chmod +rx /usr/local/bin
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

//後面的地址你能夠打開Xcode顯示包內容,找到那個文件夾拖到終端裏面比較不容易錯。

而後再pod setup

 

更新完Xcode8以後,用pod拉完項目,用git發現不能用,(沒用到pod的項目能夠正常使用git),

報的圖以下>

每次都要輸入,用戶名及密碼,而後還老是驗證不過,

後來想到用命令行試試,在終端使用 git push 指令

給我報個這,

那麼問題就明瞭了,是git的地址被pod弄混了,

而後更新項目的git地址 git remote set-url origin xxxxxxxxxxxx(這裏填項目的git地址)

再git push

提示輸入帳號密碼,

而後

去公司的git內網看了下,上傳成功,解決問題.又能夠愉快的code了.

 

2016-11-10更新

最近用pod又出問題了,git拉下來的新工程,install的時候出錯

[!] /usr/local/bin/git clone https://github.com/bang590/JSPatch.git /var/folders/hx/sswypb8n0lg94qy3s12jsdyr0000gn/T/d20161110-28964-9p7j8k --template= --single-branch --depth 1 --branch 1.1

Cloning into '/var/folders/hx/sswypb8n0lg94qy3s12jsdyr0000gn/T/d20161110-28964-9p7j8k'...
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

Stack Overflow    上面找到了解決方案

解決方法是從新配置了 github 的 SSH Key

 

期間從新安裝pod的時候還遇到這個問題

Setting up CocoaPods master repo
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master

Cloning into 'master'...
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': SSLRead() return error -9806

 

由於實在是太大,網速不給力,

我只好到同事的Mac的

~/.cocoapods/repos目錄下面拷貝出master文件到本身的Mac上的相應位置.

相關文章
相關標籤/搜索