1.创建Test项目,创建TestLib,添加Person类

2.git init

3.提交代码

4.创建项目的podspec文件


5.修改podspec文件,保存
s.name = "TestLib"
s.version = "0.0.1"
s.summary = "TestLib"
s.description = "TestLib测试"
s.homepage = "http://EXAMPLE/TestLib"
s.license = "MIT"
s.source = { :git => "", :tag => "#{s.version}" } #本地的git不用填
注意:s.summary的内容一定要比s.description的内容短
s.homepage本地私有库不需要改,如果是远程的话就需要修改
6.在Test文件夹下创建podfile文件


7.修改podfile文件,再pod install

8.出错:

出错原因:上面的写法会在远程仓库中查找,我们的TestLib是本地的,当然查找不到

9.修改podfile文件,使它在本地查找

10.重新pod install,安装成功

打开项目,可以在Development Pods(本地库存放位置)中看到TestLib,在Test工程里#import <Person.h>就可以使用了

11.如果Person类有改动的话,需要重新提交代码,cd 到TestLib目录下提交

12.如果新建文件:在Classes中新建两个文件

cd 到Test目录下,pod install


网友评论