iOS学习笔记Mac&iOS常规使用iOS开发

集成自己独有的pod,并发布到CocoaPods trunk,以

2017-03-16  本文已影响660人  茗涙

大体步骤可以总结为以下几行命令

pod spec create JHDynamicFont
git tag -m"pod spec" "0.0.1"
git push origin --tags
pod trunk register 807880748@qq.com 'jinghao' --description='ios developer' --verbose
pod lib lint --allow-warnings
pod trunk push JHDynamicFont.podspec --allow-warnings
Pod::Spec.new do |s|

  s.name         = "JHDynamicFont"
  s.version      = "0.0.1"
  s.summary      = "通过为UIFontDescriptor添加category方法实现动态改变指定控件(如UILabel UIButtonLabel等)的字体大小。"
  s.description  = <<-DESC
  通过为UIFontDescriptor添加category方法实现动态改变指定控件(如UILabel UIButtonLabel等)的字体大小!!!
                   DESC

  s.homepage     = "https://github.com/Shenjinghao/JHDynamicFont"
  # s.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"

  s.license      = "MIT"
  # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }

  s.author             = { "shenjinghao" => "807880748@qq.com" }

  s.source       = { :git => "https://github.com/Shenjinghao/JHDynamicFont.git", :tag => "#{s.version}" }

  s.source_files  = "Classes", "JHDynamicFont/Classes/**/*.{h,m}"
  s.exclude_files = "Classes/Exclude"
  s.requires_arc = true
  s.platform     = :ios

end

具体步骤可以参考相关文章链接

下面主要介绍下集成过程出现的问题及解决方法,以我自己提交的一个项目(JHDynamicFont,通过UIFontDescriptor可以动态修改字体大小,项目地址)为例:

  • NOTE | [OSX] xcodebuild: /Users/shenjinghao/Desktop/Module/MyModule/JHDynamicFont/JHDynamicFont/JHDynamicFont/Classes/JHSliderView.h:9:9: fatal error: 'UIKit/UIKit.h' file not found
 s.platform     = :ios
  • ERROR | file patterns: The source_files pattern did not match any file.
s.source_files  = "Classes", "JHDynamicFont/Classes/**/*.{h,m}"

-> JHDynamicFont (0.0.1)
- ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone https://github.com/Shenjinghao/JHDynamicFont.git /var/folders/lc/zl333w0s6t12qjdfl0_brmdh0000gn/T/d20170315-37512-16fmh2q --template= --single-branch --depth 1 --branch 0.0.1
Cloning into '/var/folders/lc/zl333w0s6t12qjdfl0_brmdh0000gn/T/d20170315-37512-16fmh2q'...
warning: Could not find remote branch 0.0.1 to clone.
fatal: Remote branch 0.0.1 not found in upstream origin

git tag -m"pod spec" "0.0.1"
git push origin --tags

[!] JHDynamicFont did not pass validation, due to 1 error.
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a .swift-version file to set the version for your Pod. For example to use Swift 2.3, run:
echo "2.3" > .swift-version.
You can use the --no-clean option to inspect any issue.

echo 3.0 > .swift-version

成功提示

JHDynamicFont passed validation.

--------------------------------------------------------------------------------
 🎉  Congrats

 🚀  JHDynamicFont (0.0.1) successfully published
 📅  February 10th, 04:05
 🌎  https://cocoapods.org/pods/JHDynamicFont
 👍  Tell your friends!

刚提交后项目用pod search命令会搜不到,因为本地的索引没有更新,使用下面命令删除索引文件

rm ~/Library/Caches/CocoaPods/search_index.json

-> JHDynamicFont (0.0.1)
通过为UIFontDescriptor添加category方法实现动态改变指定控件(如UILabel UIButtonLabel等)的字体大小。
pod 'JHDynamicFont', '~> 0.0.1'

2017年03月22日17:46:44更新

Paste_Image.png
sudo gem install cocoapods 
//或者
sudo gem install cocoapods --pre
上一篇 下一篇

猜你喜欢

热点阅读