注册CocoaPods账号
-
想创建开源的Pod库,就要注册一个CocoaPods账号,我这里使用终端注册, email 用你的 GitHub 邮箱
-
在终端输入:pod trunk register
你的GitHub邮箱
'你的用户名'
pod trunk register ********@163.com 'name'
-
之后终端出现下面文字,
[!] Please verify the session by clicking the link in the verification email that has been sent to lueng2yuan@163.com
CocoaPods 会发一个确认邮件到你的邮箱上,登录你的邮箱进行确认。
- 注册成功!确认后再终端输入
pod trunk me
会输入以下信息
- Name: Alli_Balopy
- Email: lueng2yuan@163.com
- Since: January 24th, 21:31
- Pods:
- BLSearcherBar
- Sessions:
- January 24th, 21:31 - June 1st, 23:58. IP:
118.26.133.116
- March 7th, 03:28 - July 13th, 03:47. IP:
118.26.133.116
- March 7th, 19:11 - July 13th, 19:14. IP:
118.26.133.116
pod spec create BLUsuallyControl
项目github地址:https://github.com/Balopy/BLCommonControls.git
填写podspec
文件时注意
s.source_files = "TestDemo/TestDemo/BLGeneralControl/*.{h,m}"
格式
Pod::Spec.new do |s|
s.name = "BLUsuallyControls"
s.version = "0.0.1"
s.summary = "对常用的控件,UILabel, UIButton,UIImageView等简单封装一下,给大家一点启示."
s.description = <<-DESC
把控件UILabel, UIButton,UIImageView等简单封装起来,使用时更加方便一点,详情请看demo
DESC
s.homepage = "https://github.com/Balopy/BLUsuallyControls"
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.author = { "Balopy" => "lueng2yuan@163.com" }
# Or just: s.author = "Balopy"
# s.authors = { "Balopy" => "lueng2yuan@163.com" }
# s.social_media_url = "http://twitter.com/Balopy"
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.platform = :ios
# s.platform = :ios, "5.0"
# When using multiple platforms
# s.ios.deployment_target = "5.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.source = { :git => "https://github.com/Balopy/BLUsuallyControls.git", :tag => "#{s.version}" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.source_files = "TestDemo/TestDemo/BLGeneralControl/*.{h,m}"
s.exclude_files = "Classes/Exclude"
# s.public_header_files = "Classes/**/*.h"
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.resource = "icon.png"
# s.resources = "Resources/*.png"
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"
# s.library = "iconv"
# s.libraries = "iconv", "xml2"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.requires_arc = true
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency "JSONKit", "~> 1.4"
end
验证$ pod lib lint --allow-warnings
或者$ pod lib lint XXXX.podspec --allow-warnings
或者$ pod spec lint XXXX.podspec
验证成功,打tag
$ git commit -m Release 0.0.1
$ git tag 0.0.1
$ git push --tags
$ git push origin master
发布
$ pod trunk push BLUsuallyControls.podspec
成功如下
Updating spec repo `master`
--------------------------------------------------------------------------------
🎉 Congrats
🚀 BLUsuallyControls (0.0.1) successfully published
📅 March 7th, 20:41
🌎 https://cocoapods.org/pods/BLUsuallyControls
👍 Tell your friends!
--------------------------------------------------------------------------------
查找
BalopydeMacBook-Pro:BLUsuallyControls Balopy$ pod search BLUsuallyControls
报错
[!] Unable to find a pod with name, author, summary, or description matching `BLUsuallyControls`
解决
BalopydeMacBook-Pro:BLUsuallyControls Balopy$ rm ~/Library/Caches/CocoaPods/search_index.json
查找
BalopydeMacBook-Pro:BLUsuallyControls Balopy$ pod search BLUsuallyControls
成功
Creating search index for spec repo 'baijia'.. Done!
Creating search index for spec repo 'master'..
网友评论