如何上传自己的开源项目到Cocoapods

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cl61917380/article/details/84869937

项目结构:

根据我的项目结构,所有我的spec.source_files = “CLKits/CLKits/CLKits/**/*.{h,m}” 表示CLKits下所有的文件夹和文件

1.Create File (.podspec):

ps: spec.source表示github上的代码位置,在commits 中查看

#
#  Be sure to run `pod spec lint CLKits.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see https://docs.cocoapods.org/specification.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |spec|
  spec.name         = "CLKits"
  spec.version      = "1.0.0"
  spec.summary      = "CLKit just save your time"
  spec.homepage     = "https://github.com/coooliang/CLKits"
  spec.license      = { :type => "MIT", :file => "LICENSE" }
  spec.author       = "coooliang"
  spec.platform     = :ios, "8.0"
  spec.source       = { :git => "https://github.com/coooliang/CLKits.git", :commit => "ec99b4327097338b134ca6a67ce2e2e7f9ac7a0e" }
  spec.source_files  = "CLKits/CLKits/CLKits/**/*.{h,m}"
  spec.requires_arc = true
  spec.frameworks = "Foundation","UIKit"
  spec.dependency "AFNetworking", "~> 3.2.1"
  spec.dependency "pop", "~> 1.0.12"


end

2.Validate Project:

忽略警告
pod spec lint CLKits.podspec --allow-warnings
或者
pod spec lint CLKits.podspec --verbose

验证成功:
在这里插入图片描述

3.Push to Cocoapods

PS:需要添加一个tag在你对应的分支
在这里插入图片描述

pod trunk push CLKits.podspec --allow-warnings

在这里插入图片描述

4.成功后更新库并查看

//pod setup
rm ~/Library/Caches/CocoaPods/search_index.json
pod search CLKits

在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/cl61917380/article/details/84869937