cocoapods初始化項目
-
pod lib create FTSmartDeviceModule
模板創(chuàng)建項目項目工程 - 初始化項目倉庫
- 1.1.
git init
初始化git - 1.2.
git add .
將項目的所有文件添加到緩存中 - 1.3.
git commit -m "first commit"
將緩存中的文件Commit到git庫 - 1.4. 把遠程倉庫地址添加到當前 終端輸入
git remote add origin https://git.oschina.net/XXX/XXX.git
- 1.5 上傳代碼最好先拉一下代碼
git pull origin master
如果出現(xiàn)錯誤 issuerefusing to merge unrelated histories
解決方式:
git pull origin master --allow-unrelated-histories
- 1.6 提交代碼到遠程倉庫
git push origin master
CocoaPods 私有庫集成問題點
- [!] The repo
FXSpecs
at../.cocoapods/repos/FXSpecs
is not clean解決 cd到repo目錄 查看有沒有沒提交的文件 執(zhí)行
git clean -f
push repo 成功-
私有庫驯耻,關于圖片資源文件的加載和xib的加載 見代碼示例
[[[NSBundle bundleForClass:[MemberCell class]] loadNibNamed:NSStringFromClass([MemberCell class]) owner:self options:nil] lastObject];
更改repo
- 修改代碼,更改podspec 版本對應次乓,tag版本 提交代碼到遠程倉庫皆辽,創(chuàng)建tag
git tag 0.x
提交到遠程git push --tags
- 開始驗證倉庫有沒有問題有沒有問題 pod lib lint
- 如果創(chuàng)建的私有庫榛鼎,依賴于其他私有庫 執(zhí)行 pod lib lint 當前文件名.podspec --sources='http://[privateLibName]/cocoaspecs.git,https://github.com/CocoaPods/Specs.git'
- 執(zhí)行命令
pod repo push FTRepostitories FTSmartDeviceModule.podspec --allow-warnings
前面是存放podspec文件的repo- 如果里面用到了framework 加參數(shù):--use-libraries
- 執(zhí)行pod search FTSmartDeviceModule
- 執(zhí)行搜索過程中搜索不到刪除緩存索引
rm ~/Library/Caches/CocoaPods/search_index.json
就能搜到
- 執(zhí)行搜索過程中搜索不到刪除緩存索引
- [問題]
[!] Unable to find a specification for
image.png