用CocoaPods導(dǎo)入框架出現(xiàn)的問題

當(dāng)你拿到別人的代碼在自己的電腦上運行的時候,有時候會發(fā)現(xiàn)用CocoaPods導(dǎo)入的框架報錯了,例如AFNetworking框架。下面是一些可能出現(xiàn)的一些錯誤整合:

pod install 后出現(xiàn)的問題:
$ 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

$ pod repo add master https://gitcafe.com/akuandev/Specs.git有可能出現(xiàn)錯誤,就用pod setup,如果用pod setup卡住,那么可以用如下的方式:
1,cd ~/.cocoapods //進到安裝cocoa pod 的repo目錄
2,open . //打開目錄此時里面應(yīng)該是空的啥也沒有
具體的操作方式

具體操作。 
cd ~/.cocoapods/repos 
git clone https://github.com/CocoaPods/Specs.git master
這個命令需要的時間是很長的,如果中間出現(xiàn)錯誤:
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
如果你安裝了多個xcode,命令需要修改一下
$ sudo xcode-select -switch /Applications/Xcode 7.3.1.app/Contents/Developer
在重新執(zhí)行g(shù)it clone https://github.com/CocoaPods/Specs.git master這個命令,完成以后,就可以pod install了
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容