Installation and use of Cocoapods

Cocoapods: Written in Ruby, it is responsible for managing a third-party class library management tool under iOS and OS X systems
 When introducing third-party libraries, it can automatically complete various configurations for us, configure the compilation phase, linker options, and even -fno-objc-arc configuration in the ARC environment, etc.
 
1. Upgrade the Ruby environment
sudo gem update -n /usr/local/bin --system
 
2. Replace the ruby ​​image
 
$ gem sources --remove https://rubygems.org/
 
$ gem sources -a https://gems.ruby-china.org/
 
$ gem source -l
 
3. Install Cocoapods
 
sudo gem install -n /usr/local/bin cocoapods
 
$ pod setup
 
4. Use Cocoapods 
 
pod --version
 
5. Create project Demo, cd + Demo directory
 
Create configuration file touch Podfile
 
vim Podfile input i insert for insert operation
platform : ios,'8.0' (minimum version supported by the system)
target 'ProjectName' do (the name of the project project)
  pod 'name of the open source framework', '~>3.2.1'
end
 
6. pod install installation

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324739663&siteId=291194637