1、安裝或更新Cocoapods時提示沒權限
$ gem install cocoapods
Fetching: cocoapods-core-0.38.2.gem (100%)
ERROR: while executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
解決辦法:在命令行前加入 sudo
$ sudo gem install cocoapods
password:
Fetching: cocoapods-core-0.38.2.gem (100%)
2、安裝或更新第三方庫時提示找不到庫
$ pod install
Analyzing dependencies
[!] Unable to find a specification for 'AfNetworking (~> 2.0)'
原因:要麼是安裝完Cocoapods後沒執行pod setup,要麼就是pod setup失敗
解決辦法:清除後,重新 setup,執行以下命令
$ pod repo remove master
$ pod setup
3、安裝或更新第三方庫時卡主或超慢
$ pod install
Updating local specs repositories
或
$ pod install
Analyzing dependencies
原因:被牆了
解決辦法:使用以下命令進行 install 或 update
$ pod install --verbose --no-repo-update
$ pod update --verbose --no-repo-update
4、安裝或更新第三方庫時出現如下警告
[!] 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.
原因:
1、不要使用文本編輯去編輯Podfile文件,使用Xcode編輯,或者使用終端敲命令去編輯。
2、Podfile 的內容語法格式有問題
5、安裝或更新第三方庫時出現如下錯誤
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target
ParentPortal
toPods/Target Support Files/Pods/Pods.debug.xcconfig
or include thePods/Target Support Files/Pods/Pods.debug.xcconfig
in your build configuration.[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target
ParentPortal
toPods/Target Support Files/Pods/Pods.release.xcconfig
or include thePods/Target Support Files/Pods/Pods.release.xcconfig
in your build configuration.
解決辦法:修改Configurations爲None,如下圖所示
6、OSX系統升級到10.11後,無法使用 Cocoapods 命令
$ -bash: pod: command not found
解決辦法:
$ sudo install -n /usr/local/bin cocoapods
之後 pod 命令就可以正常使用了