github 创建仓库
new 一个 repository
clone 到本地 并初始化工程
创建.podspec
文件
$pod spec create 工程名
文本编辑打开.podspec
文件
Pod::Spec.new do |s|
s.name = "RJMyPod"
s.version = "0.0.1"
s.summary = "A iOS Fast integration of custom classifications, macro definitions and tool classes"
s.homepage = "https://github.com/Jack424/RJMyPod.git"
s.license = "MIT"
s.author = { "Jack_Gu" => "gu_ruijie@163.com" }
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/Jack424/RJMyPod.git", :tag => s.version}
s.source_files = "RJMyPod/RJMyPod/MyPod/*.{h,m}"
s.requires_arc = true
s.resources = "RJCategoryTool/RJCategoryTool/RJCategoryTool/Resource/*.{png,xib,nib,bundle,json}"
end
s.dependency 'Masonry'
# s.resources = 'PhotoBrowser/resource/*.{png,xib,nib,bundle}'
# s.frameworks = 'UIKit','Photos','PhotosUI'
# s.dependency 'UMengUShare/Social/ReducedWeChat', '~> 6.4.8.2'
end
s.name :工程名
s.version :版本号
s.summary :简介概述
s.homepage :github项目网页
s.license :授权许可文件
s.author :代码作者
s.platform :支持最低的版本号
s.source :git代码下载地址
s.source_files :!重要 ! 你要传到cocoapods的文件内容
s.resources :资源文件,没有可忽略
s.requires_arc :是否是ARC
注意:s.source_files 下层级目录一定是podspec所在层级的文件名开始到你要上传的文件目录为止 *.{h,m} 表示匹配所有以.h和.m结尾的文件 ** 表示匹配所有子目录 若所上传文件夹有子级文件则在文件名后追加 **/*.{h,m}
解决[-Werror,-Wnon-modular-include-in-framework-module]错误, .h文件中引用第三方库 #import <Masonry/Masonry.h>,使用尖括号引用
上传过程中遇到问题就细心检查一下
$ git add --all
$ git commit -m "操作内容"
$ git tag "0.0.1"
$ git push --tags
$ git push origin master
验证上传是否合法
$ pod spec lint --allow-warnings
-> RJMyPod (0.0.1)
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')
Analyzed 1 podspec.
RJMyPod.podspec passed validation.
出现成功提示后就trunk上传,如果没有没有注册过需要首次注册
$ pod trunk register 邮箱 '用户名' --description='描述一下下'
邮箱及用户名以你GitHub的为准
提交指令后需要去邮箱验证,点击或复制邮箱邮件内的链接会显示
自我验证
$ pod trunk me
- Name: Jack424
- Email: gu_ruijie@163.com
- Since: September 18th, 2017 21:46
- Pods:
- GRJKit
- GRJMITKit
- RJCategoryTool
- Sessions:
- September 18th, 2017 21:46 - January 25th, 2018 01:13. IP: 120.236.169.38
Description: macbook pro
- February 14th, 20:57 - June 23rd, 05:36. IP: 27.115.4.10
Description: 描述一下下
- 报错及解决
$ pod trunk me
[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.
$ pod trunk register 'gu_ruijie@163.com' 'Jack424' --description='mac pro'
// 然后去邮箱操作一下即可
/*
Please confirm your CocoaPods session by clicking the following link:
https://trunk.cocoapods.org/sessions/verify/**************
If you did not request this you do not need to take any further action.
*/
提交
$ pod trunk push --allow-warnings
使用一下
pod 'RJMyPod'
$ pod install
如果报错:- ERROR | [iOS] unknown: Encountered an unknown error (Malformed version number string ) during validation.
$ sudo gem install -n /usr/local/bin cocoapods
Password:
Fetching: cocoapods-core-1.7.1.gem (100%)
Successfully installed cocoapods-core-1.7.1
Fetching: cocoapods-deintegrate-1.0.4.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.4
Fetching: xcodeproj-1.9.0.gem (100%)
Successfully installed xcodeproj-1.9.0
Fetching: fourflusher-2.3.0.gem (100%)
Successfully installed fourflusher-2.3.0
... ...
ZLPhotoBrowser 使用 SDWebImage 报错
打印错误信息
pod spec lint RJCategoryTool.podspec --verbose
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- ERROR | [iOS] xcodebuild: ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLBigImageCell.m:504:77: error: use of undeclared identifier 'SDWebImageProgressiveDownload'; did you mean 'SDWebImageProgressiveLoad'?
- NOTE | [iOS] xcodebuild: SDWebImage/SDWebImage/Core/SDWebImageDefine.h:69:5: note: 'SDWebImageProgressiveLoad' declared here
[!] The spec did not pass validation, due to 2 errors.
ZLPhotoBrowser更新日志
3.0.3: 依赖库SDWebImage升级为5.0.2以上
● 3.0.6: 添加选中图片显示index功能; 新增(及修改)部分颜色api,方便修改框架内部颜色; 修改框架默认风格为微信的风格; 压缩图片资源;
● 3.0.5: 预览快速选择界面文字颜色支持自定义; 编辑界面按钮增大; 解决录制视频超过10s没有声音的bug;
● 3.0.4: 添加视频选择最大最小个数限制; 解决网络gif图片无法播放的bug; fix已知bug;
● 3.0.3: 依赖库SDWebImage升级为5.0.2以上; 解决图片浏览器关闭时取消所有sd图片请求的bug; 支持直接调用相机;
● 3.0.0: 压缩bundle内图片; 支持直接选择iCloud照片,并添加解析图片超时时间属性;
● 3.0.0: 支持carthage; 去除GPUImage滤镜;
● 2.7.8: 添加iCloud图片加载进度条,支持iCloud视频播放;
● 2.7.6: 预览大图界面支持precent情况下的下拉返回;
● 2.7.5: 编辑图片支持自定义工具类型; bug fixed;
● 2.7.4: 横滑大图界面添加下拉返回; 不允许录制视频时候不请求麦克风权限;
● 2.7.1: 支持自定义导航返回按钮图片;
● 2.7.0: 图片资源加上前缀,解决9.0无法选择图片问题;
● 2.6.9: 重构编辑图片功能,添加滤镜;
● 2.6.7: 优化视频编辑界面,极大减少进入时的等待时间;
● 2.6.6: Fix #216; 新增隐藏裁剪图片界面比例工具条功能;
● 2.6.5: 新增隐藏"已隐藏"照片及相册的功能; Fix #221, 优化预览网络图片/视频时根据url后缀判断的类型方式;
报错
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down
$ pod update
Update all pods
Updating local specs repositories
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down
$ pod repo update master --verbose
Updating spec repo `master`
$ /usr/bin/git -C /Users/jintian/.cocoapods/repos/master fetch origin --progress
remote: Enumerating objects: 12756, done.
remote: Counting objects: 100% (12756/12756), done.
remote: Compressing objects: 100% (440/440), done.
remote: Total 33049 (delta 12458), reused 12299 (delta 12299), pack-reused 20293
Receiving objects: 100% (33049/33049), 3.68 MiB | 85.00 KiB/s, done.
Resolving deltas: 100% (22711/22711), completed with 3716 local objects.
From https://github.com/CocoaPods/Specs
279b00360ea..4826f4cad15 master -> origin/master
$ /usr/bin/git -C /Users/jintian/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/jintian/.cocoapods/repos/master reset --hard origin/master
Checking out files: 100% (3441/3441), done.
HEAD is now at 4826f4cad15 [Add] QBRouter 0.0.5
$ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AFNetworking 4.0.1 (was 3.2.1 and source changed to `https://github.com/CocoaPods/Specs.git` from `trunk`)
Installing AlipaySDK-iOS 15.7.4 (was 15.6.8 and source changed to `https://github.com/CocoaPods/Specs.git` from `trunk`)
Installing MBProgressHUD 1.2.0 (was 1.1.0 and source changed to `https://github.com/CocoaPods/Specs.git` from `trunk`)
Installing MJRefresh 3.4.1 (was 3.2.2 and source changed to `https://github.com/CocoaPods/Specs.git` from `trunk`)
Installing WechatOpenSDK 1.8.7.1 (was 1.8.6 and source changed to `https://github.com/CocoaPods/Specs.git` from `trunk`)
Generating Pods project
Integrating client project
Pod installation complete! There are 17 dependencies from the Podfile and 17 total pods installed.
[!] Automatically assigning platform `iOS` with version `10.0` on target `RJCategoryTool` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[!] CDN: trunk URL couldn't be downloaded:
$ pod search AFNetworking
[!] CDN: trunk Repo update failed - 2 error(s):
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/a/7/5/AFNetworking/4.0.0/AFNetworking.podspec.json Response: Couldn't connect to server
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/a/7/5/AFNetworking/4.0.1/AFNetworking.podspec.json Response: Couldn't connect to server
$ pod repo remove trunk
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use
--verbosefor more information.
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
...
[!] The spec did not pass validation, due to 1 error.
$ pod spec lint RJCategoryTool.podspec --verbose //打印错误信息
ERROR | [iOS] unknown: Encountered an unknown error (/usr/bin/xcrun simctl list -j devices
$ pod trunk push --allow-warnings
$ pod trunk push --allow-warnings --use-libraries
Updating spec repo `master`
CocoaPods 1.8.0 is available.
To update use: `sudo gem install cocoapods`
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.8.0
Validating podspec
-> RJCategoryTool (0.5.5)
- ERROR | [iOS] unknown: Encountered an unknown error (/usr/bin/xcrun simctl list -j devices
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
) during validation.
[!] The spec did not pass validation, due to 1 error.
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Password:
$ pod trunk push RJCategoryTool.podspec --allow-warnings --use-libraries
Updating spec repo `master`
CocoaPods 1.8.0 is available.
To update use: `sudo gem install cocoapods`
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.8.0
Validating podspec
-> RJCategoryTool (0.5.5)
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
...
...
Updating spec repo `master`
CocoaPods 1.8.0 is available.
To update use: `sudo gem install cocoapods`
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.8.0
--------------------------------------------------------------------------------
🎉 Congrats
🚀 RJCategoryTool (0.5.5) successfully published
📅 September 27th, 04:59
🌎 https://cocoapods.org/pods/RJCategoryTool
👍 Tell your friends!
--------------------------------------------------------------------------------