美文网首页私有库
利用cocapods制作私有pod库

利用cocapods制作私有pod库

作者: YannChee | 来源:发表于2019-02-14 16:56 被阅读10次

之前写了 利用cocapods制作公有pod库https://www.jianshu.com/p/99e9c199bd64 ,其实制作私有pod库 的步骤跟公有pod库大部分一致,区别在于:

  • 公有库是直接 上传 xxxx.podspec文件到 CocoaPods/repo
pod trunk push QYAnyWaterfallLayout.podspec
  • 私有库是
    1.先要私有私有库并和项目地址做关联,使用命令
pod repo add 私有库名称 私有库地址
例如 :  
pod repo add QYPrivateLibs https://github.com/YannChee/QYPrivateLibs.git

2.向私有的库里添加podspec文件

pod repo push 私有库名称 xxx.podspec
例如:
pod repo push QYPrivateLibs QYPrivateLibs.podspec

还有就是使用上的区别:
当项目使用私有库时需要在podfile文件中添加私有库的源地址,而公有库可以不添加

source 'https://github.com/YannChee/QYPrivateLibs.git'

简单记录一下.

1.创建一个私有的项目

2.创建xxx.podspec

cd QYPrivateLibs
pod spec create QYPrivateLibs

3.编辑xxx.podspec文件

Pod::Spec.new do |s|

  s.name         = "QYPrivateLibs"
  s.version      = "0.0.1"
  s.summary      = "这个是我的私有pod库"

  s.description  = <<-DESC
                  这里保存着我的私有库用到的私有框架和文件
                   DESC

  s.homepage     = "https://github.com/YannChee"
 
  s.license      = "MIT"
  s.author             = { "YannChee" => "yannchee@163.com" }
  
  s.platform     = :ios, "8.0"

  s.source       = { :git => "https://github.com/YannChee/QYPrivateLibs.git", :tag => "#{s.version}" }

  s.source_files  = "QYPrivateLibs/**/*"

  s.requires_arc = true
end

4. 把这些改动上传到Git,并设置tag

5.验证xxx.podspec文件

pod spec lint QYPrivateLibs.podspec

6.添加一个私有库并和项目地址做绑定

pod repo add QYPrivateLibs https://github.com/YannChee/QYPrivateLibs.git

7.向私有的库里添加podspec文件

pod repo push QYPrivateLibs QYPrivateLibs.podspec

8.以上部分私有库的制作基本完成了,但使用中需要注意,如果使用了私有库,必须 要podfile中指定私有库的source

例如,我们建立一个测试项目,不指定私有库source


不指定私有库 source

在执行pod install 时直接报错

Unable to find a specification for `QYPrivateLibs`

在podfile文件中添加源地址后执行pod install

use_frameworks!

platform :ios, '12.0'

source 'https://github.com/YannChee/QYPrivateLibs.git'

target 'QYPrivateDemoProj' do

pod 'QYPrivateLibs'
  
end

此时私有库成功添加到项目中


相关文章

  • 利用cocapods制作私有pod库

    之前写了 利用cocapods制作公有pod库https://www.jianshu.com/p/99e9c199...

  • 利用cocapods制作公有pod库

    1.创建git远程仓库,并把远程仓库clone到本地 这里我以QYAnyWaterfallLayout为例 1.创...

  • 制作Pod库

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

  • iOS:CocoaPods制作私有库

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

  • 制作 CocoaPods 开源库

    CocoaPods 开源库的制作过程: 添加私有Pod仓库,用来存储私有Pod库的podspec文件,类似Coco...

  • pod search 提示Unable to find a po

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

  • 制作自己的Cocoapods

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

  • Pod私有库制作

    ##Pod私有库制作 ####目录 +安装CocoaPods +创建远程内部私有Spec Repo仓库 +模板创建...

  • pod 私有库的制作

    声明: 该文章描述,将制作好的 framework ,打包成pod 私有库 创建私有库模板 根据创建的提示,选择库...

  • 制作私有库引用Framework

    记:制作私有库时,遇到了一些问题,在此进行记录,避免再次踩坑。 感谢《关于制作私有pod库包含framework和...

网友评论

    本文标题:利用cocapods制作私有pod库

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