CocoaPods upgrade new version problem

After the company upgraded cocoapods to version 1.8.3, problems began to occur, and both pod install and pod search failed.

After executing pod install, it will keep stuck in

Analyzing dependencies

Then update to cocoapods1.8.4, the problem still exists.

After the timeout, the following error will be prompted

[!] CDN: trunk Repo update failed

According to the tutorial found on the Internet, add source to the first line of the podfile file,

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

Execute pod install again, stuck in the following situation

Analyzing dependencies
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`

solution

CocoaPods 1.8 switches the CDN to the default spec repo source which is the trunk source, and the master source must be specified in the podfile.
But it can't be used after we change the source, it may have something to do with our network, the following is my solution.

First, change the source, because I have tried several commonly used ones, but none of them work, so I switched to the source of Tsinghua University.

The following is excerpted from Tsinghua University Open Source Software Mirror Site

新版的 CocoaPods 不允许用pod repo add直接添加master库了,但是依然可以:

$ cd ~/.cocoapods/repos 
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master 最后进入自己的工程,在自己工程的podFile第一行加上: source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

Remember to remove trunk after you are done and execute the following command

pod repo remove trunk

CDN:trunk problems may also occur if remove is not performed.

two
iOS-cocoapods is slow or buggy?  Unable to add a source with url

iOS-cocoapods is slow or buggy? Unable to add a source with url

Whether it is installed with the command line sudo gem install cocoapodsor the cocoapods client installed directly, when using cocoapods for the first time, because he needs to download all the indexes of the iOS library first, it is inevitable that the download will be slow or wrong. .

The most classic mistakes:

error: RPC failed; result=18, HTTP code = 200

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

[!] Unable to add a source with url https://github.com/CocoaPods/Specs.git named master. You can try adding it manually in ~/.cocoapods/repos or via pod repo add

Solution:

It has been replaced with a domestic source, no VPN required!

1. Open Terminal (or other command line tool) on your Mac

2. Enter rm -rf ~/.cocoapodsand press Enter

3. Enter mkdir -p ~/.cocoapods/reposand press Enter

4. Enter cd ~/.cocoapods/reposand press Enter

5. Enter git clone git://cocoapodscn.com/Specs.git masterpress Enter and wait for completion.

After downloading success, you can be happy:
or continue to install on the cocoapods client;
or on the command line pod install( sudo gem install cocoapodsfor students who install cocoapods from the command line)

If it's still slow or wrong:

Connect the Mac to the 4G hotspot of the mobile phone (make sure the mobile phone is turned off wifi)

If it still doesn't work, message me.

Special Note: Do not go to  https://github.com/CocoaPods/Specs  to download the zip, and then copy the master folder to ~/.cocoapods/repos/here, because there is a .git file missing in the master folder, and it will not work after that of.