IOS 上传自己的库到cocoapod
参考:http://www.cnblogs.com/SimonGao/p/4987668.html
参考:http://www.cnblogs.com/yueyuanyueyuan/p/5560954.html
参考:http://blog.csdn.net/wzzvictory/article/details/20067595
参考:http://www.jianshu.com/p/d7d1942dd3f1
1. 工程
- 引用的第三方库,不能用#import<> 而用#import"" 设置功能的搜索选项 "Always search user paths"为YES
- 库里的文件不要有测试工程
- 上传到github
2. 制作
2.1. 添加 .podspec 文件
2.1.1. 创建
- 必须文件
- 使用命令 pod spec create name.podspec
- 或者直接拷贝一份
2.1.2. 添加内容
- 必须
- 来到仓库根目录
- 添加pods依赖库需要一个描述文件,并且文件名要和依赖库的名称一样。
- s.source_files 是源文件路径
Pod::Spec.new do |s| s.name = "ColorfulWoodUIBase" s.version = "1.0.1" s.summary = "User Interface Design." s.homepage = "https://github.com/gs01md" s.license = "MIT" s.author = { "ColorfulWood" => "103377808@qq.com" } s.source = { :git => "https://github.com/gs01md/ColorfulWoodUIBase.git", :tag => "#{s.version}" } s.source_files = "ColorfulWoodUIBase/ColorfulWoodUIBase/**/*" s.platform = :ios, "8.0"
s.frameworks = 'UIKit' s.dependency 'Masonry' end
更改的东西,先上传到github
2.2. 上传 podspec文件
2.1.1. 为 pod 添加版本号并打上tag
git tag -m "first release ColorfulWoodUIBase with podspec" "1.0.1" git push --tags
2.1.2. 验证
pod lib lint ColorfulWoodUIBase.podspec
2.1.3. 注册
pod trunk register 103377808@qq.com "ColorfulWood" --description="macbook pro"
2.1.4. 上传
pod trunk push
//失效
pod trunk push ColorfulWoodUIBase.podspec --allow-warnings
2. 添加到某个私有库
pod repo push pandapods CCElements.podspec --allow-warnings
//前面是本地Repo名字 后面是podspec名字
使用私有库
报错处理:[!] Found multiple specifications for
pod repo push pandapods CCElements.podspec --verbose --allow-warnings --sources='https://cdn.cocoapods.org/'
source 也可以是
--sources='https://github.com/CocoaPods/Specs.git'
多个source
pod repo push pandapods CCElements.podspec --verbose --allow-warnings --sources='https://cdn.cocoapods.org/,https://gitee.com/panda-education/pandapods.git'
source 'https://github.com/CocoaPods/Specs.git'
自建的git repo库上传失败,可能是licence文件、readme没有上传。
提示类似错误
note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'LaMvvm' from project 'Pods') - NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods') - NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App') - NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')