Reason: It is still a small job, the demand side wants to use Cocoapods to integrate the framework, because BEFORE, I have never made my own cocoapods, so I was confused, all kinds of information.
How to make Cocoapods:
- The code is submitted to github
- Create podspec.
- Edit podspec.
- Project to play tag
- Validation. Podspec
- Example Register the cocoapods Trunk account
- Podspec to cocoapods
1. Submit the code to Github
1. Create a new repository on Github. 2 can be another License.
2. Clone the code locally
Git add. Git commit -m “description” git push origin master
2. Create. Podspec
In the project directory, run the podspec command to create. Podspec, as shown in 3 below:
- $ pod spec create CFMobAdSDK.podspec
- $ touch CFMobAdSDK.podspec
- $ vim CFMobAdSDK.podspec
3. Edit. Podspec
Remember: don’t use text editing to open editing, don’t use text editing to open editing, don’t use text editing to open editing, you can use Atom to edit, you can use vim command to edit,vim state, press I to enter editing state, press Esc to exit editing state, and then enter :wq to save and exit editing
:Pod::Spec.new do |s|
s.name = "CFMobAdSDK"
s.version = "1.0.6"
s.ios.deployment_target = '7.0'
s.summary = "AD SDK, a simple AD SDK."
s.homepage = "https://github.com/lixianshen/CFMobAdSDK"
s.license = { :type= >"MIT", :file => "LICENSE" }
s.author = { "Simple"= >"[email protected]" }
s.source = { :git => "https://github.com/lixianshen/CFMobAdSDK", :tag => s.version }
#s.source_files = "CFMobAdSDK/*"
s.resources = "CFMobAdSDK/CFMobAdSDK.bundle"
s.frameworks = 'Foundation'.'UIKit'.'CoreLocation'.'AdSupport'
s.vendored_frameworks = 'CFMobAdSDK.framework'
s.requires_arc = true
end
Copy the code
Here’s what some of the code in podSpec means:
-
S.name: pod Search must have the same name as podSpec. Otherwise, an error will be reported
-
S. sion: indicates the version number
-
S. iso. Deployment_target: the lowest version of pod that is supported
-
S.s ummary: introduction
-
S. homepage: Project homepage address
-
S. license: Open source license (selected when creating the Github library)
-
S. Uthor: Author information
-
S.social_media_url: indicates the social network address
-
S.ource: Address of the project
-
S.source_files: source files to be included
-
S. resource: a single resource file
-
S. resources: Resource files (including bundles)
-
S. equires_arc: indicates whether ARC is supported
-
S. dependency: dependency libraries, not unpublished libraries. Such as AFNetWorking
-
S. endored_frameworks: the included framework, which is our own pod
-
Description: a longer word description than S. Summary
-
S.s creenshots: screenshots
-
S.exclude_files: hidden files
-
S.public_header_files: public header files
-
S. framwork: Required framework, single
-
S. framworks: Required framework, separated by commas
-
S. endored_libraries: included. A Precautions:
-
Multiple S.dependency can be written like this,(version number can be added): S.dependency = ‘AFNetworking’, ‘~> 2.3’ s.dependency = ‘SDWebImage’ s.dependency = ‘AFNetworking’
-
S. LICENSE = {:type => “MIT”, :file => “LICENSE”}
-
S. source_files:
"CFMobAdSDK/*
"CFMobAdSDK/*.{h,m}""CFMobAdSDK/**/*.h"
Copy the code
“: matches all files.{h,m} : matches all files ending with. H and. M. ** : matches all subdirectories
-
S. ource common notation
/// git commit -m =>"13287dd"S.ource = {:git =>"https://github.com/lixianshen/CFMobAdSDK", :commit => "13287dd"} /// bind the Pod version to a Git repository version of comit."https://github.com/lixianshen/CFMobAdSDK", :tag => 1.0.0} // bind the Pod version to the same version of comit in Git repository."https://github.com/lixianshen/CFMobAdSDK", :tag => s.version } Copy the code
4. Upload your edited.podSpec
5. Tag and upload
Git tag "v1.0.0" git push --tagsCopy the code
6. Verify. Podspec
Methods a
Pod spec Lint cfmobadsdK. podspec --verbose will display verbose messages if verification failsCopy the code
Way 2
pod spec lint
Copy the code
Verify the start
-> CFMobAdSDK
Copy the code
Success:
Some cases of verification failure: 1. In the following cases, run the echo “2.3” >. Swift-version command
2.- ERROR | [iOS] file patterns: The source_files pattern did not match any file. Solution: the file path is wrong, that is, set the s.s ource_files field, an ERROR has occurred (3) – ERROR | (iOS) file patterns: The vendored_frameworks pattern did not match any file. An error occurred while setting the s.endored_frameworks field
7. Register the Cocoapods Trunk
-
Pod –version, sudo gen install cocoaPods and Pod Setup
-
There are three ways to register:
- pod trunk register [email protected]
Eloy Durán
–description=Personal Laptop
- pod trunk register [email protected] –description=
Work Laptop
- pod trunk register [email protected]
- pod trunk register [email protected]
At this time, the email you fill in will receive an email, copy the link and open it in the browser. If you do not open the link, the following steps cannot be carried out
- To view registration information:
pod trunk me
Copy the code
- Name: lixianshen
- Email: [email protected]
- Since: May 1st, 01:51
- Pods:
- CFMobAdSDK
- Sessions:
- May 1st, 01:51 - September 7th, 08:30. IP: 125.121.226.128 Description:
Simple
- May 2nd, 18:35 - September 7th, 18:43. IP: 125.118.107.149
- May 2nd, 20:55 - September 7th, 21:05. IP: 125.118.107.149
- May 4th, 02:19 - September 9th, 02:20. IP: 125.118.107.149
Copy the code
8. Publish your own. Podspec to Cocoapods
-
pod trunk push CFMobAdSDK.podspec
-
If there is a warning :pod trunk push cfmobadsdK.podspec –allow-warnings
1. Verify that the information is correct
2. The release is successful
3. Check your published Pod
Delete the cache before you check the json text ~ / Library/Caches/CocoaPods/search_index json
If you do not delete, you will not be able to search their own posts, if you let your friends also want to find delete the existing cache
4. Search for records
If you want to delete the issued version, use the following command:
Pod Trunk delete CFMobAdSDK version numberCopy the code
For example,
Pod Trunk delete CFMobAdSDK 1.0.1Copy the code
That’s pretty much it: here are some of the better links to this content:
-
Description of the trunk command: trunk
-
Making Cocoapods is the official website for Making Cocoapods
-
Framework and.A making Framework+ A
-
Conclusion:
If you find any questions or don’t understand anything, please leave a message