If you’re a developer in China, you’ve probably experienced the terrible speed of CocoaPods due to a wall or some other reason, so you can go grab a cup of coffee every time you implement Pod Setup. CocoaPods is probably aware of the fact that the repository is getting bigger and updates are slow. In 1.7.2, CDN technology was tested to achieve speed improvement. Indifferent testing stage may be due to the lack of domestic nodes, the speed is still slow, by everyone’s criticism, but with the official release of version 1.8.0. CDN is the default source for spec, speed and so on, and it is highly recommended to upgrade.

What is the CDN

The full name of CDN is Content Delivery Network. CDN is an intelligent virtual network built on the basis of the existing network. It relies on the edge servers deployed in various places, through the central platform of load balancing, content distribution, scheduling and other functional modules, users can get the content nearby, reduce network congestion, and improve user access response speed and hit ratio. The key technologies of CDN mainly include content storage and distribution.

Colloquially, it exists as a network accelerator.

What are the changes after using CDN

Before 1.8.0, we implemented Pod by default when installing Cocoapods The setup command, will pull the whole warehouse code from https://github.com/CocoaPods/Specs.git, generally speaking, due to wall or domestic network, the process of this step is very long, the existence of at least half an hour or more.

When pod Update is performed, the entire REPO repository is not updated, but only the dependencies required by the current project are pulled.

To sum up:

With CDN we do not need to perform pod setup

After using CDN, instead of pulling the entire warehouse, it will only pull the current need, which is placed in the trunk warehouse

How to use CDN

  1. Upgrade your Cocoapods quickly

    • sudo gem install cocoapods -n /usr/local/bin
    • brew install cocoapodsHomebrew installation is recommended
  2. For projects that use or already use private libraries, you need to change the source

     source '[email protected]:jasony9982/repo.git'
    -source 'https://github.com/CocoaPods/Specs.git'
    +source 'https://cdn.cocoapods.org/'
    Copy the code
  3. In the meantime, pod Repo Remove Master free up your computer space

Improve CDN access speed

As for some friends can not access CDN, or foreign websites to solve the problem, you can register here for trial, speed stability, a lot of nodes! Improve CDN access speed

The resources

Blog.cocoapods.org/CocoaPods-1…