1. Whether executing pod install or pod update, it is stuck in Analyzing dependencies or Updating local specs repositories.
Solution : The reason is that when the above two commands are executed, the spec repository of CocoaPods will be upgraded. Adding a parameter can omit this step. Then the speed will increase a lot. The command to add parameters is as follows:
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
2. The following error is reported when the pod command is run
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.
Solution: Don't use text editor to edit Podfile
, use Xcode to edit, or use terminal to type commands to edit. Or the input format is wrong, and the running version is not input:
platform:iOS, '7.0'
3. There is no code prompt in the header file after importing the third-party class library using cocoapods
Solution : Select the Target -> Build Settings menu, find the \”User Header Search Paths\” setting item, add a new value "${SRCROOT}"
, and select \”Recursive\”
4. The dependency “ is not used in any concrete target.
Solution: This error means that you did not use the following format, edit the Podfile to the following format
platform :ios,'7.0'
target '你的app的target名字' do
pod 'AFNetworking', '2.0'
pod 'SDWebImage', '3.7'
...
end
5. Installation error
Setting up CocoaPods master repo
[!] /usr/bin/git clone 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
solve:
$ git config --global http.postBuffer 24288000
$ git config --list
If you output http.postbuffer=24288000, it will be OK
6. During pod install, the third library to be imported can be generated, but its header file cannot be found, the file is missing, and the target setting has not been completed.
[!] 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.
Solution: The reason for this warning is some settings in the project Target, and CocoaPods also made the default settings. If the results of the two settings are inconsistent, it will cause problems.
I want to use the settings in CocoaPods, where I define andPODS_ROOT
in my project, replace their values with $(inherited), go to the terminal, execute , and the error is gone.Other Linker Flags
pod update
There is also a simple and rude method:
click the project file project.xcodeproj, right-click to display the package content, open project.pbxproj with a text editor, delete OTHER_LDFLAGS
the place, save, execute pod update
, the error is gone
7. The error that the .o file is missing from the referenced third-party library to be imported
Solution: Add $(OTHER_LDFLAGS) to Other Linker Flags option in Build Setting
8. There is also a more complex error encountered when configuring cocoapods for a new project
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. Problems with cocoapods installation after Mac OS X is updated to 10.11
$ 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/ - bad response Not Found 404 (http://ruby.taobao.org/latest_specs.4.8.gz)
After updating ruby, it did not solve it. Finally, it was found that the Taobao mirror was invalid, and http://ruby.taobao.org/ was invalid. There are two
solutions :
1> Change the http of Taobao mirror to https
$ gem sources --remove http://ruby.taobao.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
Just install it again
$ sudo gem install cocoapods
2> Later, I saw an answer on stackoverflow about gem install fails with openssl failure , and replaced Taobao mirror with http://rubygems.org/ .
$ gem source -a http://rubygems.org/
Just install it again
$ sudo gem install cocoapods
10. The ruby environment needs to be updated
. Question 1:
ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
Reason: In the process of installing cocoapods, it is prompted that the Ruby version is above 2.2.2, and the currently used Ruby version is 1.8.7 that comes with the Mac system. So need to upgrade Ruby. The following are three ways to install Ruby:
1. Download the ruby source code, compile, and install
2. Use the installation package that comes with the distribution, install
3. Use rvm to install
It is recommended that you upgrade Ruby through rvm. The steps will not be repeated here. If you need it, please check the cocoapods of my blog: Installing/Updating Ruby Environment Tutorial , which contains the specific operation of installing ruby through ram.
Question 2:
ERROR: While executing gem … (Gem::DependencyError)
Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.2.0), cocoapods-downloader (< 2.0, >= 1.1.3), cocoapods-trunk (< 2.0, >= 1.1.2), molinillo (~> 0.5.5), xcodeproj (< 2.0, >= 1.4.1); activesupport requires thread_safe (>= 0.3.4, ~> 0.3); tzinfo requires thread_safe (~> 0.1)
Solution: update ruby version
Question 3:
ERROR: While executing gem … (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj
solve:
sudo gem install -n /usr/local/bin cocoapods
To cure the symptoms but not the root cause, you still need to reinstall or update ruby fundamentally
11. pod setup/ pod install error summary
Question 1:
$ pod install
Analyzing dependencies
[!] Unable to satisfy the following requirements:
-AFNetworking (~> 3.0)
required byPodfile
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 withpod 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 onpod install
by default.
solve:
$ pod repo remove master
$ pod repo add master https://gitcafe.com/akuandev/Specs.git
$ pod repo update
Question 2:
$ pod setup
Setting up CocoaPods master repo
[!] /usr/bin/git clone 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
It must be this line of code. You need to modify this command line according to your own situation. Maybe you have multiple xcodes, then your command line should be modified:
$ sudo xcode-select -switch /Applications/Xcode 7.3.1.app/Contents/Developer
Question 3:
$ pod setup
Setting up CocoaPods master repo
[!] /usr/bin/git clone 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
Question 4:
$ pod setup
Setting up CocoaPods master repo
[!] /usr/bin/git clone 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
How to solve these? In fact, after mac OS 10.11, some commands of cocoapods need to be changed. Today, I will summarize it. If you encounter the problem of pod setup or pod update, and it is difficult to solve, I suggest that it is better to uninstall and reinstall. 10.11 After that, there are some different commands to install cocoapods, which are summarized below:
1. Check the ruby environment, and update it as follows if necessary
$ sudo gem update --system
2. Uninstall cocoapods
$ sudo gem uninstall cocoapods
3. Reinstall cocoapods (the installation command has changed)
before 10.11
$ sudo gem install cocoapods
After 10.11
$ sudo gem install -n /usr/local/bin cocoa pods
4.
$ sudo chmod +rx /usr/local/bin
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
//Copy the CocoaPods Specs repository to the ~/.cocoapods directory on your computer
pod setup
The solution can refer to cocoapods: Error adding third-party class library for new project
Reference article: http://www.jianshu.com/p/b5315bf42975