目录

Cocoapods之私有库发布及使用

目录

本文以github为例
1、打开你的github主页,选择 New repository .

a. Repository name 填写 DCSpecs。
b. Description 可以不填写。
c. 选择 Private 或 Public。
d. 勾选 Initialize this repository with a README。
e. 点击 Create repository 按钮。

2、打开终端,进入目录,执行命令

1
pod repo add DCSpecs https://github.com/dsencheng/DCSpecs.git

3、执行成功后,可以进入目录查看 ~/.cocoapods/repos/ ,是否有DCSpecs文件夹。

4、在DCServices.podspec文件目录,推送私有库。

1
pod repo push DCSpecs DCServices.podspec

DCServices是code。
DCSpecs 是管理和记录。它会记录DCServices的0.1.0,0.1.1 … 1.5.3。
写命令时,注意区分DCServices 和 DCSpecs

5、在项目中引入私有库。打开你开发的项目,如果没有Podfile,请先初始化。添加内容

1
2
3
4
5
6
7
8
9
source 'https://cdn.cocoapods.org/'
source 'https://github.com/dsencheng/DCSpecs.git'

platform :ios, ‘9.0’

target “your_target_name”   
    do
        pod 'DCServices'
    end

打开终端在当前项目目录执行pod install完成!