CocoaPods is a dependency management tool for developing a third-party library of OS X and IOS applications. With CocoaPods, you can define your own dependencies (called pods ), and it is easy to manage the versioning of third-party libraries over time and throughout your development environment.
The concept behind CocoaPods is mainly embodied in two aspects. First, the introduction of third-party code in the project involves a lot of content. For OBJECTIVE-C junior developers, the configuration of engineering files can be frustrating. During the configuration of build phases and linker flags, there are many human factors that can cause errors. CocoaPods simplifies all of this by automating the configuration of compilation options.
Second, through the CocoaPods, it is convenient to find a new third-party library. Of course, this is not to say that you can simply put the library provided by others together into an application. Its real role is to enable you to find a truly useful library to shorten our development cycle and improve the quality of our software.
1. Upgrade the Gem First (note: The system is newer than the MAC can skip this step 1, the following URL is also part of the command) sudo gem update--system2. Toggle Cocoapods Data Source "Delete, add, view" gem sources--remove https://rubygems.org/Gem sources-a https://ruby.taobao.org/Gem Sources-L3Install cocoapods sudo gem install cocoapods or (e.g. 10.11 system) sudo gem install-n/usr/local/bin Cocoapods4Switch the Podspec file hosting address from GitHub to the domestic address "first delete, then add, then Update" pod repo remove master pod repo add master https://Gitcafe.com/akuandev/specs.gitpod Repo update5. Set POD warehouse pod setup6. Test "If there is a version number, the installation is successful" pod--version7. Use Cocoapods to install a third-party framework onenter the. Xcodeproj Sibling folder for the project to which you want to install the framework GenevaCreate a new file in this folder PodfileGenevain the file, tell cocoapods the framework information that needs to be installed a. platform supported by the Framework B. Applicable iOS version C. Framework name D. Framework version8InstallationUpdate pod Install--no-repo-Update (to be updated directly using pod install) pod Update--no-repo-Update9. Description Platform:ios,'8.0'used to set the minimum iOS version of the pod supported by all third-party libraries'Sdwebimage','~>2.6'rules for setting the frame's name and version number:'>1.0'any version above 1.0 can be installed'>=1.0'any version above or equal to 1.0 can be installed'<1.0'any version less than 1.0'<=1.0'any version less than or equal to 1.0'~>0.1'any version that is above or equal to 0.1, but does not contain a version above 1.0'~>0'any version, the equivalent of a non-specified version, by default the latest version numberTenthe approximate process after installing the framework using the Pod Install command: onAnalysis Dependencies: This step analyzes podfile to see dependencies between different class libraries. If more than one class library relies on the same class library, but relies on different versions, Cocoapods automatically sets a compatible version. GenevaDownload Dependency: Download the specified version of the class library to a local project, based on the results of the analysis dependency. GenevaBuild a Pods project: Create a Pods project that is designed to compile and manage third-party frameworks, Cocoapods will add the required frameworks, libraries, and so on to the project, and configure them accordingly. GenevaConsolidate PODS projects: integrate pods and projects into one workspace, and set up file links.
Note: Using the Xcode plugin Cocoapods-xcode-plugin-master can simplify the 7th, 8 two steps to create a file Podfile , plug-in specifically using the reference GitHub.
iOS Development-cocoapods Installation