本文转自:http://www.jianshu.com/p/4b63dfbd8be7

前情提要

公司项目一直在用CocoaPods管理第三方包,自己也想着将项目中的公用模块抽离出来独立的包。所以研究了一下。

准备工作

github创建私有库 如testSpecs.git

pod repo add testSpecs https://github.com/qgg/testSpecs.git

github创建工具库 如QGGImagePicker 注意创建的时候勾选开源协议
命令行创建模版工程
pod lib create QGGImagePicker

根据提示创建完成

XXXXXX$ pod lib create QGGImagePicker
Cloning `https://github.com/CocoaPods/pod-template.git` into `QGGImagePicker`.
Configuring QGGImagePicker template.
------------------------------
To get you started we need to ask a few questions, this should only take a minute.
If this is your first time we recommend running through with the guide: - http://guides.cocoapods.org/making/using-pod-lib-create.html( hold cmd and double click links to open in a browser. )
What language do you want to use?? [ ObjC / Swift ]> ObjC
Would you like to include a demo application with your library? [ Yes / No ]> Yes
Which testing frameworks will you use? [ Specta / Kiwi / None ]> None
Would you like to do view based testing? [ Yes / No ]> No
What is your class prefix?> QGG

完成后打开工程目录如下:工具库主要在红框内容Classes目录下进行开发

1.png

修改工程下的.podspec文件,如

# Be sure to run `pod lib lint QGGImagePicker.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#Pod::Spec.new do |s|s.name             = "QGGImagePicker"s.version          = "0.0.1"s.summary          = "QGGImagePicker."# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!  s.description      = <<-DESCA ImagePicker Like WeChat's ImagePickerDESCs.homepage         = "https://github.com/infiniteQin/QGGImagePicker.git"# s.screenshots     = "www.example.com/screenshots_1", "www.example.com/screenshots_2"s.license          = 'MIT's.author           = { "changqin" => "changqin@ixiaopu.com" }s.source           = { :git => "https://github.com/infiniteQin/QGGImagePicker.git", :tag => s.version.to_s }# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'s.platform     = :ios, '7.0's.requires_arc = trues.source_files = 'Pod/Classes/**/*','Pod/Classes/**/**/*'#s.resource_bundles = {#  'QGGImagePicker' => ['Pod/Assets/*.png']#}#s.resources = "Pod/*.xcassets"# s.public_header_files = 'Pod/Classes/**/*.h's.frameworks = "UIKit", "AssetsLibrary"s.dependency 'Masonry', '~> 0.6.3'
end

本地验证

pod lib lint

验证成功后推送工程到github给如QGGImagePicker工具库打tag(和podspec中的版本保持一致)

验证远程库

pod spec lint

看到输出如下内容就成功了

QGGImagePicker.podspec passed validation.

私用库中添加工具库

pod repo push testSpecs QGGImgePicker.podspec

使用

pod search QGGImagePicker
Podfile文件添加 pod 'QGGImagePicker', '~> 0.0.1'
pod update --verbose --no-repo-update
注意这时候会报错,解决办法
pod spec lint --sources=‘https://github.com/qgg/testSpecs.git,https://github.com/CocoaPods/Specs'
或者
将~/.cocoapods/repos/testSpecs/下的内容copy到~/.cocoapods/repos/master/Specs下

支持CocoaPods公开库

到https://github.com/CocoaPods/Specs.git 下fork一份
将私有库中的.podspec文件转成.json

$ pod ipc spec QGGImagePicker.podspec >> QGGImagePicker.podspec.json

将内容(目录结构如下)添加到CocoaPods/Specs提交待作者审核后即可

CocoaPods私有库配置笔记相关推荐

  1. 搭建CocoaPods私有库

    基于git搭建CocoaPods私有库 1.创建并设置一个私有的Spec Repo. 2.创建Pod的所需要的项目工程文件,并且有可访问的项目版本控制地址. 3.创建Pod所对应的podspec文件. ...

  2. 关于CocoaPods私有库的那点事情

    关于CocoaPods私有库的那点事情 私有库 组件化的基本操作 首先得安装好CocoaPods,不懂的童鞋出门右拐找百度 终端命令都是在podspec所在目录,除了pod lib create和po ...

  3. CocoaPods私有库创建

    CocoaPods私有库创建 参考链接 为什么要使用私有库和私有库索引 对于个人来说,可以进行代码积累.我们在创建新项目,很多基础代码会进行复用,都会引入自己常用的代码.还有一些自定义代码,快速代码, ...

  4. CocoaPods - podspec私有库配置

    工程引用 Podfile中添加以下cocoaPods指令,在终端输入pod install构建 source 'https://github.com/zhengmiaokai/Specs.git' p ...

  5. 创建Cocoapods私有库

    本文以自己在公司做的一个手势密码私有库GesturePasswordKit为例说明. 1.在gitlab(或者github,我这里使用的例子是在gitlab上)上创建git仓库 (确保授权正确,避免后 ...

  6. CocoaPods私有库搭建的记录

    前言 随着项目的业务增加以及马甲包进度的跟进,一些重复的独立业务以私有库的方式引入到项目中对于项目进度的开发就显得越发的迫切了,本文主要记录自己搭建私有库时的整个流程,以防后面再次搭建时忘记,方便自己 ...

  7. Cocoapods 私有库

    Cocoapods是非常好用的一个iOS依赖管理工具,使用它可以方便的管理和更新项目中所使用到的第三方库, 以及将自己的项目中的公共组件.(cocoapods的安装请自行百度) 1.创建自己的私有sp ...

  8. maven私有库配置

    不同的项目,不同的私有库 1.添加仓库 Release 发布: 发行仓库 snapshot 快照,开发,调试仓库 配置完成 2.配置权限 默认开通的权限,查看权限 给刚才建的两个私有库添加权限 配置好 ...

  9. CocoaPods公有库和私有库制作

    认识公有库和私有库 公有库:开源自己封装的库供别人使用,且往cocoaPods的官方Repo仓库(即CocoaPods Master Repo)中新增自己库的索引,该库索引是以*.podspec.js ...

最新文章

  1. 阿里P8连肝一周整理出这份python自动化测试实战PDF
  2. 【转】使用Xcode中的iOS SDK给iphone开发出第一个App程序
  3. Ajax 开发中遇到的乱码问题
  4. asp开发中存储过程应用全接触 _asp技巧
  5. 分布式文件系统HDFS,大数据存储实战(一)
  6. iOS: 让自定义控件适应Autolayout注意的问题
  7. 配置SpringMVC框架
  8. Hyper-v副本容量规划器
  9. request转发,response重定向,异步请求json数据输出到页面
  10. 多方安全计算、联邦学习、可信计算 对比区别
  11. LINUX下载编译FriBidi
  12. 最适合使用外汇跟单软件的人
  13. ISO语言代码(ISO-639)与国家代码(ISO-3166)
  14. 计算机型号win7,win7cpu型号怎么看
  15. mysql http_put_洪永佳 - SegmentFault 思否
  16. 如何在低代码开发平台上,实施表单设计流程
  17. Unity3D添加天空盒
  18. Java基本语法总结
  19. oracle日文全角变化,日文windows系统 oracle数据库乱码的处理
  20. uboot 或者 linux 下限制 sata speed

热门文章

  1. flex布局换行后均匀分布
  2. linux 怎么看当前时间,Linux 查看当前时间和修改系统时间(示例代码)
  3. 10 个面试技巧帮你找到最好的工作 !
  4. 基本数据类型与构造数据类型
  5. matlab编程题,Matlab编程习题
  6. Ubuntu 查看系统资源占用(CPU、内存、网络)
  7. H5 下载word文件时预览失败,提示无法预览此文件,它可能已损坏,有部分可可以查看预览
  8. 负载均衡的三种实现方式
  9. 多种风机功率曲线的过滤方法
  10. SpringBoot打包docker镜像并桥接mysql(windows版)