美文网首页
【iOS】将代码上传到pod创库

【iOS】将代码上传到pod创库

作者: mapleYe | 来源:发表于2020-01-17 10:24 被阅读0次

1、利用pod创建项目

pod lib create PPKit

这时候的生成工程目录为


目录.png

编写podspec文件

#
# Be sure to run `pod lib lint PPKit.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = 'PPKit'
  s.version          = '0.0.1'
  s.summary          = 'A short description of PPKit.'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://github.com/maple1994/PPKit'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'maple1994' => '305554601@qq.com' }
  s.source           = { :git => 'https://github.com/maple1994/PPKit.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'

  s.source_files = 'PPKit/Classes/**/*'
  
  # s.resource_bundles = {
  #   'PPKit' => ['PPKit/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end

可以看到我们指定source_files指定在PPKit/Classes文件夹下的所有文件,所以我们的源码都放在这里就可以了

2、上传代码到pod

podspec文件编辑好后,我们就可以上传该文件到pod上了,进入podspec同级目

pod trunk push

如果之前没有注册pod账号的,先注册/登录也是执行以下指令

pod trunk register 305554601@qq.com 'maple'

3、私有库

私有库跟公有库最大的区别就是,podspec的文件摆放位置。如果podspec文件都上传到github上的 https://github.com/CocoaPods/Specs,所以如果我们想搭建私有库,我们也要在自己的仓库搭建一个专门存放specs文件的地方。那么我们上传spec文件的时候,就要添加仓库和推送指定的仓库

// 添加
pod repo repoName git@git.xxx.xxx:iOSPods
// 推送
pod repo push repoName xxx.podspec

更详细的内容可以参考
http://www.cocoachina.com/articles/26210

相关文章

  • 【iOS】将代码上传到pod创库

    1、利用pod创建项目 这时候的生成工程目录为 编写podspec文件 可以看到我们指定source_files指...

  • 利用Cocoapods创建私有库

    一、将文件上传到svn或者git,进到文件夹使用pod spec create YourFramework 命令创...

  • iOS 将个人framework上传至私有pod库

    需求:将项目中的一个模块制作成一个可移植的代码库。上传到pod移植起来会更方便,也方便版本管理。 一、实施步骤 制...

  • 2020-08-08

    iOS 代码因为需要新加一个库 执行pod install 报错 [!] Error installing Car...

  • Pod组件化

    总的来说分成三部 1、接使用代码源pod集成2、pod添加本地资源,将spec文件上传到本地资源中3、注册trun...

  • [iOS] unknown: Encountered an un

    pod 库 pod lib lint报错[iOS] unknown: Encountered an unknown...

  • CocoaPods公有库

    通过创建公有库,可以供内部和外部通过pod的方式,来管理和依赖相应的模块,达到对iOS工程模块化,将项目代码进行解...

  • iOS制作pod私有库

    1、在Git仓库分别创建2个私有库,一个索引库,一个是pod代码库 2、将远程索引库添加到本地 3、创建本地pod...

  • iOS-使用CocoaPods创建私有仓库(一)

    iOS-创建私有仓库步骤 一、创建本地pod私有库 cd到你想创建pod库工程的路径,并执行pod库的创建。命令如...

  • pod install慢

    pod install慢主要还是因为github上的代码库访问速度慢 只需要给github上的代码库设置个代理,我...

网友评论

      本文标题:【iOS】将代码上传到pod创库

      本文链接:https://www.haomeiwen.com/subject/ookczctx.html