參考:[http://www.itdecent.cn/p/199edc7cc868]
一、若本地?zé)o私有庫
1.創(chuàng)建庫
創(chuàng)建一個(gè)名字為LocalLib的文件夾,然后在該文件夾下面創(chuàng)建一個(gè)Classes的文件夾,Classes文件夾作用是放庫代碼。
來到Classes文件夾下創(chuàng)建庫文件
1. 終端執(zhí)行命令 cd /Users/chenwanbing/Desktop/代碼/本地私有庫/LocalLib/Classes
2. 終端執(zhí)行命令 touch CWB.h CWB.m
2.修改spec文件的關(guān)鍵信息,注意用Xcode打開spec文件 主要信息如下
s.version = "0.0.1" //版本號(hào)
s.summary = "LocalLib." //小描述
s.description = "LocalLib.sasss" //大描述 比上面那個(gè)長就行
s.homepage = "http://EXAMPLE/LocalLib" //這個(gè)不用修改用生成的就行
s.license = "MIT" //MIT協(xié)議
s.author = { "cmfish" => "ichenwanbing@163.com" } //不用改
s.source = { :git => "", :tag => "#{s.version}" } //把git =>后面引號(hào)里面的路徑刪掉
s.source_files = "Classes", "Classes/**/*.{h,m}" //這個(gè)不用改
#s.exclude_files = "Classes/Exclude" //把這段注釋掉 #代表注釋
3.創(chuàng)建和LocalLib 【同級(jí)文件夾】 的空項(xiàng)目作為測試工程。
來到工程文件夾下
終端執(zhí)行命令 pod init
用Xcode打開Podfile文件進(jìn)行編輯common+s保存并關(guān)閉.
platform:ios,,,,,,,,
target,,,,,,,
pod 'LocalLib',:path =>'../LocalLib'
end
4.終端執(zhí)行命令pod install
5.完成之后,項(xiàng)目的pods根目錄下會(huì)多出一個(gè)Development Pods文件夾,里面存放著剛導(dǎo)入的私有庫。
二、若本地已經(jīng)存在私有庫
1.修改該私有庫的spec文件中的
s.source = { :git => "xxxxxx", :tag => "#{s.version}" } //把git =>后面引號(hào)里面的原始路徑刪掉
s.license = "MIT" //MIT協(xié)議,去除mit之外的其他字符
#s.exclude_files = "Classes/Exclude" //把這段注釋掉 #代表注釋
其他不變。