组件化Git操作
查看本地有哪些pod索引库
pod repo
别忘了加.git
pod repo add SYXZSpecs https://gitee.com/pzhwz520/SYXZSpecs.git
创建代码库
pod lib create SYXZToolsKit
添加代码
git add .
git commit -m '初始化'
绑定远程库
git remote add origin https://gitee.com/pzhwz520/SYXZAPIsKit
提交代码到远程
git push origin master
添加tag(注意:不要加引号!!)
git tag 0.1.0
git push --tags
验证
pod spec lint --verbose --allow-warnings
添加到本地库及远程库
pod repo push SYXZSpecs SYXZCategory.podspec --verbose --allow-warnings
如果使用了私有库时需要添加私有库地址
验证
pod库内部引用其他库 不能使用#import <SYXZCategory/SYXZCategory-umbrella.h> 这种方式 直接#import "NSDate+Extension.h"
引用第三方库使用#import <AFNetworking/AFNetworking.h> 而不能用#import "AFNetworking.h"
pod lib lint --sources=https://gitee.com/pzhwz520/SYXZSpecs,https://github.com/CocoaPods/Specs.git --verbose --use-libraries --allow-warnings
推送到私有库
pod repo push SYXZSpecs SYXZHome.podspec --sources=https://gitee.com/pzhwz520/SYXZSpecs,https://github.com/CocoaPods/Specs.git --verbose --use-libraries --allow-warnings
pod install --no-repo-update
pod update --verbose --no-repo-update
pod update SYXZBase --no-repo-update
Podfile添加私有库地址
source 'https://gitee.com/pzhwz520/SYXZSpecs.git'
source 'https://github.com/CocoaPods/Specs.git'
搜索不到公有库或私有库时
rm ~/Library/Caches/CocoaPods/search_index.json
pod search AFN
更新本地库索引
pod repo update SYXZSpecs
错误
fatal: remote origin already exists.
解决
git remote rm origin
git remote add origin https://gitee.com/pzhwz520/SYXZToolsKit.git
删除tag
git tag -d 0,1,1
添加资源错误
s.source_files一定要添加{h,m},防止nib加载冲突
s.source_files = 'SYXZHome/Classes//.{h,m}'
s.resources = 'SYXZHome/Classes//.xib'
s.resource_bundles = {
'SYXZHome' => ['SYXZHome/Assets/*']
}
引入公共头文件
在SYXZBase.podspec中添加
s.prefix_header_contents = '#import "SZYBaseMacro.h"'