创建并发布自己的公有库和如何把私有库的文件分多层目录存储

简介: 创建并发布自己的公有库和如何把私有库的文件分多层目录存储

我想把我的私有组件的文件分目录存储,我在网上搜了一大堆,但是实验后全部检查不通过。最近我终于找到原因了。因为网上文章抄来抄去全部都不正确,原因是因为在注释前是podspec格式文件不支持的"//"。而podspec格式文件支持注释符号是"#"。失之毫厘,谬以千里。

1、建立工程,创建.podspec文件。

#
# Be sure to run `pod lib lint YXPaylibraryManager.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 http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = 'BITCocoaLumberjack'
  s.version          = '0.0.3'
  s.summary          = 'BITCocoaLumberjack.'

# 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         = 'http://www.baidu.com/'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'jiaguoshang' => 'jia12216@163.com' }
  s.source           = { :git => 'https://gitee.com/jia12216/BITCocoaLumberjack.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'

#**/*表示Classes目录及其子目录下所有文件
#  s.source_files = 'BITCocoaLumberjack/Classes/**/*'

  #第一层文件夹名称Default(虚拟路径),千万别把目录名称写成Classes,或者检查势失败,Classes应该是系统保留字
  s.subspec 'Default' do |ss|
    #下载Classes下所有的.h和.m文件
    ss.source_files = 'BITCocoaLumberjack/Classes/*.{h,m}'
    #允许使用import<CocoaLumberjack.h>
    ss.public_header_files = 'BITCocoaLumberjack/CocoaLumberjack.h'
    #允许使用import<CocoaLumberjackMacro.h>
    ss.public_header_files = 'BITCocoaLumberjack/CocoaLumberjackMacro.h'
    #允许使用import<CocoaLumberjackNoLogsMacro.h>
    ss.public_header_files = 'BITCocoaLumberjack/CocoaLumberjackNoLogsMacro.h'
    
    #第二层文件夹名称Extensions(虚拟路径)
       ss.subspec 'Extensions' do |sss|
       #下载Extensions下所有的.h和.m文件
       sss.source_files = 'BITCocoaLumberjack/Classes/Extensions/*.{h,m}'
    end
  end

  # s.resource_bundles = {
  #    'BITCocoaLumberjack' => ['BITCocoaLumberjack/Classes/*.xcassets']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
   s.frameworks = 'UIKit', 'Foundation'
   #s.dependency 'ReactiveCocoa', '~> 2.5'  #依赖制定版本的组件
end

若是使用s.source_files = ‘BITCocoaLumberjack/Classes/**/*’,那么它是表示的是Classes目录及其子目录下所有文件。

ss.subspec ‘Extensions’ do |sss|是表示第二层文件夹名称Default(虚拟路径)。

有时间成功和你只差两个字符。

2、编辑检查podspec文件。

pod spec lint BITCocoaLumberjack.podspec  --allow-warnings
w1:BITCocoaLumberjack jiaguoshang$ pod spec lint BITCocoaLumberjack.podspec  --allow-warnings

 -> BITCocoaLumberjack (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.

BITCocoaLumberjack.podspec passed validation.

3、在码云或gitHub创建公有项目,打版本标签,上传工程。

4、Cocoapods注册Trunk。

这个邮件有时间发过来不是一般的慢啊!

不行了多发几次吧!

收到的确认邮件

拷贝粘贴激活链接到浏览器上打开

w1:BITCocoaLumberjack jiaguoshang$ pod trunk register jia12216@163.com 'jiaguoshang'
[!] Please verify the session by clicking the link in the verification email that has been sent to jia12216@163.com
w1:BITCocoaLumberjack jiaguoshang$ pod trunk me
  - Name:     jiaguoshang
  - Email:    jia12216@163.com
  - Since:    December 5th, 2017 06:32
  - Pods:
    - AERequestManage
  - Sessions:
    - December 5th, 2017 06:32 -     April 13th, 03:45. IP: 218.72.30.25
    Description: macbook air
    - November 28th, 03:55     - April 5th, 2019 03:55. IP:
    125.119.191.112
    - November 28th, 18:59     - April 5th, 2019 19:00. IP:
    125.119.191.112

4、上传配置到公有源。

pod trunk push BITCocoaLumberjack.podspec --allow-warnings
w1:BITCocoaLumberjack jiaguoshang$  pod trunk push BITCocoaLumberjack.podspec --allow-warnings
Updating spec repo `master`
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 30696 and retry the command.

CocoaPods 1.6.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.6.0.beta.2

Validating podspec
 -> BITCocoaLumberjack (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')

Updating spec repo `master`

CocoaPods 1.6.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.6.0.beta.2


--------------------------------------------------------------------------------
   Congrats

   BITCocoaLumberjack (0.0.1) successfully published
   November 28th, 20:53
   https://cocoapods.org/pods/BITCocoaLumberjack
   Tell your friends!
--------------------------------------------------------------------------------

5、把自己的公有库添加到podfile文件并更新pod来测试下。

w1:HZBitSmartLock jiaguoshang$ pod update --verbose --no-repo-update
Integrating client project

Integrating target `Pods-HZBitSmartLock` (`HZBitSmartLock.xcodeproj` project)
  - Running post install hooks
    - cocoapods-stats from
    `/Users/jiaguoshang/.rvm/gems/ruby-2.4.0@global/gems/cocoapods-stats-1.0.0/lib/cocoapods_plugin.rb`

Sending stats
      - BITCocoaLumberjack, 0.0.1

-> Pod installation complete! There are 1 dependencies from the Podfile and 1 total pods installed.

[!] The `HZBitSmartLock [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-HZBitSmartLock/Pods-HZBitSmartLock.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `HZBitSmartLock [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-HZBitSmartLock/Pods-HZBitSmartLock.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.


目录
相关文章
|
12月前
|
人工智能 自然语言处理 算法
2025AI数字人企业名单列表新发布及全栈技术指南
数字人产业正迎来技术与应用的双重突破,全栈自研与生态协同并行发展。从虚拟主播到工业元宇宙,十强企业各展所长:像衍科技以产学研一体化构建全链条技术壁垒,阿里、京东布局电商与服务,华为、腾讯深耕工业与社交场景。数字人已跨越“仿真”阶段,迈向情感化、智能化、资产化新纪元,广泛应用于政务、医疗、教育等领域,实现降本增效与体验升级。未来,“安全可控+轻量部署+类人交互”将推动数字人成为虚实共生的核心生产力。
|
前端开发 Java 关系型数据库
诊所管理软件门诊系统源码,采用SpringBoot+Vue2.0+MySQL技术栈开发,已成功落地百余项目
诊所管理软件门诊系统,基于SpringBoot+Vue2.0+MySQL开发,专为中小诊所及连锁门诊打造信息化平台。支持电子处方、病历、检验检查、会员管理、智能诊断等功能,助力医疗机构实现数字化、智能化运营,已成功落地百余项目,稳定可靠,支持二次开发。
548 1
|
12月前
|
JSON 监控 API
淘宝店铺所有商品API接口指南
淘宝店铺商品API支持通过HTTP请求获取指定店铺的全部商品信息,涵盖基础资料、价格库存、销量评价及图片链接,适用于电商分析与竞品监控。需AppKey+AppSecret认证,支持分页与排序查询。
|
10月前
|
人工智能 弹性计算 自然语言处理
2026年阿里云 OpenClaw(Clawdbot)一键部署教程(图文版)
2026年AI Agent爆发在即,OpenClaw(原Clawdbot/Moltbot)作为开源、本地优先的AI智能代理平台,支持7×24小时私人助理部署。它不止聊天,更能执行文件处理、日程管理、跨平台自动化等真实任务,兼容Qwen/GPT/Claude等多模型,是您的全能“数字员工”。
934 17
|
12月前
|
JSON 监控 API
京东商品列表 API使用指南
京东商品列表API是京东开放平台提供的核心接口,支持按关键词、分类、价格、销量等条件筛选商品,返回标题、价格、库存、销量等结构化信息,适用于店铺管理、价格监控、竞品分析等场景。需认证开发者身份并获取appkey、access_token及相应权限后调用,接口以JSON格式传输,部分按量计费。
|
11月前
|
数据采集 人工智能 监控
AI智能体是刚需还是噱头?3大争议辨真相
AI智能体赛道冰火两重天:微软豪掷百亿押注,Cerebras却黯然退场。资本狂热背后,是生产力革命还是泡沫?西门子、蚂蚁等落地案例展现潜力,但多数企业困于集成成本与技术瓶颈。低代码平台降低门槛,也引发生态锁死担忧。短期ROI难算清,长期价值需战略定力。智能体不是万能药,唯有回归业务本质,方能穿越 hype,走向真正落地。
474 0
|
11月前
|
人工智能 运维 数据可视化
告别繁琐巡检:AR智能眼镜打造工业&电力运维闭环体系|阿法龙XR云平台
本方案以AR眼镜为核心,融合蓝牙定位、AI识别与多模态感知技术,构建智能巡检体系。通过精准定位触发、AI实时识别仪表状态、数据自动上传与可视化管理,实现电力、化工、智能制造等场景下巡检效率提升60%、故障率降低40%,推动工业运维数字化、标准化、闭环化转型。(238字)
|
存储 弹性计算 固态存储
阿里云服务器按量付费与包年包月收费标准,云服务器最新活动价格参考
阿里云的价格一直是用户最为关注的,阿里云这两年也多次做了降价策略,阿里云根据用户的实际需求,针对云服务器收费模式推出按量付费与包年包月两种收费模式,云服务器价格表2025最新版,轻量应用服务器38元一年起,ECS云服务器2核2G3M带宽99元1年、2核4G5M带宽199元一年,新品通用算力型u2i实例4核4G1120.44元/1年起、4核8G1170.26元/1年起,九代云服务器计算型c9i实例8核16G6037.01元/1年起、通用型g9i实例8核32G7551.94元/1年起、内存型r9i实例8核64G9937.12元/1年起。叠加阿里云推出的各种优惠券还可享受满减优惠。