美文网首页
制作自己的Pod库

制作自己的Pod库

作者: 我是不是叫没烦恼 | 来源:发表于2017-05-23 14:19 被阅读25次
  1. 首先在github新建repo


    github.png
  2. clone仓库至本地


    clone.png
  3. 初始化项目


    initial.png
  4. 创建podspec文件

pod spec create MBMediator https://github.com/MarioBiuuuu/MBMediator.git
podspec.png
  1. 配置podspec
Pod::Spec.new do |s|
  s.name         = "MBMediator"
  s.version      = "0.0.1"
  s.summary      = ""
  s.description  = <<-DESC
                   DESC
  s.homepage     = "https://github.com/MarioBiuuuu/MBMediator"
  s.license      = "MIT"
  s.author             = { "AuthorName" => "AuthorEmail" }
  s.platform     = :ios, "7.0"
  s.source       = { :git => "https://github.com/MarioBiuuuu/MBMediator.git", :tag => s.version}
  s.source_files  = "MBMediator", "MBMediator/**/*.{h,m}"
end

s.source_files = ' ' 的多种写法

ss.source_files = 'MBMediator/Class/*.{h,m}'

表示MBMediator/Class/目录下的所有 .h 和 .m 文件

s.source_files = 'MBMediator/**/ .'

/后面的 . 应是 星号,MarkDowm语法冲突在此不能正常显示
表示MBMediator/ 目录下所有文件,包括子目录下所有文件。 **/.表示递归
当有多个文件时,应用,隔开

 s.source_files = 'MBMediator/Class.{h,m}', 'MBMediator/Util*'
  1. 给项目打tag,并push到远程仓库
git tag 0.0.1

push到远程仓库

git push origin --tags
  1. 验证podspec是否正确
pod lib lint
liblint.png
  1. pod Trunk注册
 pod trunk register email地址 'MBMediator'
trunk.png

根据提示前往邮箱确认,然后执行

pod trunk me
trunkme.png
  1. 上传MBMediator.podspec 到 CocoaPods/repo
pod trunk push MBMediator.podspec
result.png
  1. 检验
pod search MBMediator
  1. 上传成功后搜索不到自己的库怎么办?
[!] Unable to find a pod with name, author, summary, or descriptionmatching '······'

删除~/Library/Caches/CocoaPods目录下的search_index.json文件
由于pod setup成功后会生成~/Library/Caches/CocoaPods/search_index.json文件。
终端输入rm ~/Library/Caches/CocoaPods/search_index.json
删除成功后再执行pod search

相关文章

  • 制作Pod库

    目录 一、公有Pod库制作 二、私有Pod库制作 三、subspec子库的制作 四、遇到的坑 一、公有Pod库制作...

  • 制作自己的Cocoapods

    制作自己的Cocoapods 创建自己私有pod库,官方推荐使用 pod lib create [pod name...

  • Cocopods 提示target has transitive

    制作自己的pod库时,依赖其他第三方库,在pod install时提示: 解决方案:在自己的pod库.podspe...

  • iOS:CocoaPods制作私有库

    本章制作私有库方法省去了繁琐的Pod校验,快速简单制作私有库。 创建索引库 我使用的是GitHub 制作Pod 再...

  • 制作自己的Pod库

    首先在github新建repogithub.png clone仓库至本地clone.png 初始化项目initia...

  • 制作自己的pod库

    开发中,如果有比较成熟的组件或代码库想要开放给别人使用,制作成pod库是很好的选择:一方面便于用户使用,另一方面版...

  • pod search 提示Unable to find a po

    制作cocoapods私有库时,输入pod search Person (Person为自己私有库)发现提示"[!...

  • 创建自己的pod库并上传

    参考:如何制作自己的Pod库 - 简书 报错 ··· error: include of non-modular ...

  • 制作自己的pod私有库

    第一步,创建git仓库 用你自己的GitHub账号创建一个空仓库,名字与你本地项目名字相同,记录git地址 第二步...

  • 如何制作自己的Pod库

    1、创建仓库: 2、将仓库克隆本地: git clone https://github.com/236021963...

网友评论

      本文标题:制作自己的Pod库

      本文链接:https://www.haomeiwen.com/subject/xjawxxtx.html