CocoaPods for iOS development (objective-c third-party library management tool)
Introduction:
During iOS development, in most cases, we need to integrate some third-party dependent libraries. For a slightly larger project, the number of third-party dependent libraries used is also very large. CocoaPods is an objective-c third-party library management tool to facilitate the management of third-party libraries.
Usage: 1. Install
$ sudo gem install cocoapods
Update cocoaPods
gem update cocoapod
If the gem is not the latest, execute the command
sudo gem update --system
2. Usage
Create a Podfile In the iOS project directory
File to add third-party dependent libraries, as shown in figure
source 'https://github.com/CocoaPods/Specs.git'platform :ios, '8.0'pod 'AFNetworking', '~> 2.0'pod 'ARAnalytics', '~> 2.7'
How can I find a third-party library? For example, if I want to find MKNetworkKit, run the command on the terminal.
pod search MKNetworkKit
You can add <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + PC9wPgo8cHJlIGNsYXNzPQ = "brush: java;"> pod 'mknetworkkit', '~> 0.87'
Add directly
pod 'MKNetworkKit'
We recommend that you use a stable version number to automatically load the latest database. If the modification method of the latest dependent database is unstable, your project will not run unless you need the latest dependent database features.
Cd to the Podfile directory and run
pod install
To update the dependent database, run
pod update
3. Run
In the project directory, open (project name). xcworkspace
Here, the third-party dependent libraries are automatically loaded into the project, good luck!
4. submit the project to git
Add
# podPods/
In this way, the dependent libraries are ignored and the git libraries are simplified. Others only need to update the dependent database to the local machine.
Refer:
1. http://cocoapods.org/