美文网首页
cocoapods踩坑

cocoapods踩坑

作者: 福利加班死 | 来源:发表于2018-03-08 16:56 被阅读0次

最近在给项目搞组件化,想到把拆分出来的组件单独维护,考虑cocoapods的易用,所以尝试着将一部分已经剥离出来的组件放在cocoapods上。

步骤(安装cocoapods步骤略过):

1.创建 *.podspec
在终端,进入项目的目录,执行命令:

//命令中 MXCCategory 是组件化模块的名称
$ pod spec create MXCCategory

2.编辑 *.podspec

Pod::Spec.new do |s|
  s.name         = "MXCCategory"
  #版本号
  s.version      = "0.0.2"
  #简介
  s.summary      = "test"
  #描述
  s.description  = <<-DESC
                    Category经过整理后常识使用pods来管理
                   DESC
  #项目主页
  s.homepage     = "https://github.com/evafan2003/"
  #许可证
  s.license      = { :type => "MIT", :file => "LICENSE" }
  #发布者信息
  s.author             = { "hefei" => "evafan2003@aliyun.com" }
  #项目适用平台
  s.platform     = :ios, "8.0"
  #项目主页
  s.source       = { :git => "https://github.com/evafan2003/CategoryRepertory.git", :branch => "master", :tag => "v#{s.version }" }
  #项目主页
s.source_files  = "Category", "Category/**/*.{h,m}"
  #项目需要使用到的框架
  # s.framework  = "SomeFramework"
  # s.frameworks = "SomeFramework", "AnotherFramework"
  #项目使用到的系统依赖库
  # s.library   = "iconv"
  # s.libraries = "iconv", "xml2"
  #需要用到的cocoapods依赖库,不能依赖未发布的库
  # s.dependency "JSONKit", "~> 1.4"

s.source一般可以这么写:

s.source = { :git => "https://github.com/evafan2003/CategoryRepertory.git", :commit => "68defea" }
s.source = { :git => "https://github.com/evafan2003/CategoryRepertory.git", :tag => 0.0.1 }
s.source = { :git => "https://github.com/evafan2003/CategoryRepertory.git", :tag => s.version }

3.创建并编辑LICENSE文件

The MIT License (MIT)

Copyright (c) 2018 evafan2003 <evafan2003@aliyun.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

如果发布到cocoapod这个是必须要有的,如果在创建Git仓库的时候没有创建这个文件,可以创建一个,内容格式按照上面的编辑就可以了。

4.将自己的项目打上tag标签
没啥说的,Git的相关操作

4.验证.podspec文件
到此检查一下你工程下面的文件, 你的项目, .podspec文件, LICENSE文件
然后执行命令

// --verbose 如果验证失败会报错误信息
pod spec lint MXCCategory.podspec --verbose

5.注册CocoaPods


6.发布

pod trunk push MXCCategory.podspec --allow-warnings
屏幕快照 2018-03-09 下午5.26.56.png

7.问题整理

pod install 出现 Unable to find a specification for xxxxx
在工程目录执行下面代码,更新pod仓库

pod repo update

相关文章

  • 踩坑,使用cocoaPods import导入时没有提示的解决办

    续上篇写的,踩坑,cocoaPods ---- framework not found Pods之后 ,又踩坑了。...

  • pod 报错

    CocoaPods踩坑:activate_dependencies': Could not find 'CFPro...

  • cocoapods踩坑

    最近在给项目搞组件化,想到把拆分出来的组件单独维护,考虑cocoapods的易用,所以尝试着将一部分已经剥离出来的...

  • Cocoapods安装踩坑

    初衷是安装CocoaPods,但是过程中遇到了一些问题,在此总结下 更新日期:2018年5月10日 系统:10.1...

  • CocoaPods 踩坑小记

    记一些工作中遇到的小问题,给需要的人。 模块化项目应该都会遇到类似的问题,业务库经常变动必须在功能开发完成...

  • 踩坑,cocoaPods ---- framework not

    1.关闭项目2.打开项目3.到Target中的General中的Linked Frameworks and Lib...

  • Cocoapods 安装踩坑

    换了台新电脑装Cocoapods可给坑惨了,下载Specs真的是太慢了啊,还容易遇到各种问题,费事又费力,看了一下...

  • 升级cocoapods踩坑

    最近用的好好地cocoapods突然出了问题!!!记录一下在执行pod update时,报以下的错! [!] Fa...

  • CocoaPods重装踩坑

    OS系统 10.14.6 Xcode版本 10.3 Ruby版本:2.3.7 (版本查看命令:ruby -v) 查...

  • cocoaPods安装踩坑

    执行:sudo gem install cocoapods 错误:Building native extensio...

网友评论

      本文标题:cocoapods踩坑

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