當(dāng)你拿到別人的代碼在自己的電腦上運(yùn)行的時候轴总,有時候會發(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 //進(jìn)到安裝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了