一膝宁、創(chuàng)建Spec索引庫(kù)
1憎茂、創(chuàng)建一個(gè)git倉(cāng)庫(kù)挚躯,并執(zhí)行以下命令:
pod repo add LeoPodspec https://gitee.com/ayangcool100/leo-podspec.git
此時(shí)乳规,在~/.cocoapods/repos
目錄下形葬,會(huì)新增一個(gè)LeoPodspec
的文件夾.
可以通過(guò)命令:
pod repo
來(lái)檢查下本地的cocoapods索引庫(kù),這是我本地的顯示:
LeoPodspec
- Type: git (master)
- URL: https://gitee.com/ayangcool100/leo-podspec.git
- Path: /Users/leo/.cocoapods/repos/LeoPodspec
trunk
- Type: CDN
- URL: https://cdn.cocoapods.org/
- Path: /Users/leo/.cocoapods/repos/trunk
2暮的、將本地的podspec文件推送到遠(yuǎn)程索引庫(kù)中:
先cd到LeoPrivatePodTest.podspec所在的目錄荷并,然后執(zhí)行:
// LeoPodspec是剛才創(chuàng)建的索引庫(kù),LeoPrivatePodTest.podspec為需要上傳的podspec
pod repo push LeoPodspec LeoPrivatePodTest.podspec --allow-warnings
// 不需要校驗(yàn)時(shí)可以使用這個(gè)
pod repo push LeoPodspec LeoPrivatePodTest.podspec --verbose --allow-warnings --use-libraries --skip-import-validation
現(xiàn)在已經(jīng)成功的將本地私有庫(kù)推送到了遠(yuǎn)程索引庫(kù)中青扔。
二源织、使用私有庫(kù)
1、創(chuàng)建LeoPrivatePodTestDemo
并在工程目錄下創(chuàng)建Podfile文件微猖,內(nèi)容如下:
// 指定從自己創(chuàng)建的索引庫(kù)查找
source "https://gitee.com/ayangcool100/leo-podspec.git"
use_frameworks!
platform :ios, '9.0'
target 'LeoPrivatePodTestDemo' do
pod 'LeoPrivatePodTest'
end
執(zhí)行:
pod install
然后就可以打開(kāi)LeoPrivatePodTestDemo.workspace
并使用了谈息。
三、下載的項(xiàng)目編譯報(bào)錯(cuò)解決
pod deintegrate
pod update