Use Cocoapods to manage third-party libraries in iOS engineering.
Cocoapods can effectively manage third-party libraries, prevent conflicts and keep them up to date.
1. Download and install Cocoapods
Installing cocoapods requires a ruby environment, and now the OS comes with a ruby environment, open terminal input: sudo gem install cocoapods Wait a few minutes (if Ruby environment version is low, need to update Ruby, terminal input: sudo gem Update--system). If successful there will be a hint of successfully installed Cocoapods.
2, Cocoapods use
Create the Podfile file in the project, the Terminal CD project directory file such as: Cd/users/user/desktop/demo/calayer. Create Podfile file via vim, terminal input: Vim podfile, enter, keyboard input I enter VIM insert mode, enter:
1 2 3 4 5 |
Platform:ios, ' 7.0 ' Pod ' mantle ' Pod ' Lbblurredimage ' Pod ' tsmessages ' Pod ' Reactivecocoa ' |
Then press ESC and enter the ":" Sign into the VIM command mode, then enter WQ after the colon (indicating write and exit)
3. In the terminal input pod install?
The initialization pod is also a network request download process, wait a period of time, if the input resource name is not a problem, then over a period of time will be in the terminal to initialize the successful prompt.
4, enter the project folder, you can see a suffix name is not. workspace file, double-click Open, Project code is written here.
Note: When adding a new third party, after modifying the Podfile file, you need to re-execute the pod install command.
Use of Cocoapods in iOS engineering