制做cocoapods第三方库实践

一、在GitHub上建立一个远程仓库,并选择License文件。

二、建立本身的项目,并调整好目录结构

三、建立.podspec

该文件描述项目的信息。 在项目的目录下使用终端命令建立 pod spec create PFExtensionios

Pod::Spec.new do |s|

  s.name         = "PFExtension"
  s.version      = "0.0.1"
  s.summary      = "some classes extension"
  s.homepage     = "https://github.com/pengfei2015/PFExtension"
  s.license      = { :type => "MIT" }
  s.author             = { "xxxxxx" => "xxxxxxx@xx.com" }
  s.platform     = :ios
  s.platform     = :ios, "9.0"
  s.source       = { :git => "https://github.com/pengfei2015/PFExtension.git", :tag => "#{s.version}" }
  s.source_files  = "Soureces/*.swift"

end
复制代码

四、验证.podspec文件的格式

pod lib lintgit

五、解决验证的error

一、The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a .swift-version file to set the version for your Pod. For example to use Swift 2.3, run:
`echo "4.0" > .swift-version` // swift版本号
复制代码
二、WARN | [iOS] license: Unable to find a license file

这是由于本地建立的项目里没有license文件,将GitHub上的文件拉下来就行 若是建立远程仓库的时候忘记选择,能够在首页建立文件,填入license后,右边会有模板,选择建立就行github

六、关联GitHub

git remote add origin https://github.com/pengfei2015/PFExtension.git
    git push -u origin master
复制代码

七、建立版本号(tag)

git tag 0.0.1 // git tag -a 0.0.1 -m "备注"
    git push --tags
复制代码

八、注册cocoapods

pod trunk register GitHub_email 'user_name' --verbosejson

等待终端显示成功后登录邮箱验证swift

九、提交spec

pod trunk push PFExtension.podspec缓存

十、提示成功后删除本地缓存的search_index.json

rm ~/Library/Caches/CocoaPods/search_index.jsonbash

相关文章
相关标签/搜索