Latest 1.0.0
Homepage https://github.com/LeeFengHY/MyPodDemo
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit, Foundation
Authors

自己动手实现自己的库支持cocoPods

要支持cocoPods,需先注册trunk

  1. 注册trunk 命令

sudo gem install cocoapods

pod trunk register 邮件名 [用户名]

邮件名是一个真实的邮箱地址:QQ,hotmial,126等等
用户:leefenghy
  • 注册成功后返回你的实际邮箱地址进行确认
  • 可以用 pod trunk me查看个人信息

以上完成后接下来才是开始

  1. github上面new 一个Repository
  2. 选择Public
  3. ☑️Initialize this repository with a README
  4. Add.gitignoreObjective-C, Add.license.MIT

把刚才新建的Repositoryclone到你本地

  1. 用终端cd 到你刚才lclone到本地文件的根目录
  2. 新建一个podspec后缀的文件,终端命令为:pod spec create XXXXX
  3. 编辑xxxx.podspec,在终端进入编辑:vi xxxx.podspec 修改如下信息:可选
    Pod::Spec.new do |s|
    s.name         = "LLLaunchAd"
    s.version      = "1.0.0"
    s.summary      = "A iOS LaunchAd show of MyPodDemo."
    s.homepage     = "https://github.com/LeeFengHY/MyPodDemo"
    s.license      = "MIT"
    s.author             = { "LeeFengHY" => "[email protected]" }
    s.platform     = :ios, "7.0"
    s.source       = { :git => "https://github.com/LeeFengHY/MyPodDemo.git", :tag => "1.0.0" }
    s.source_files  = "LLLaunchAd/*.{h,m}"
    s.frameworks = "UIKit", "Foundation"
    s.requires_arc = true
    s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
    end
  4. 把你要开源的库文件放入到clone本地文件夹中,并和刚才修改过的xxxx.podspec一并提交到git仓库中
  5. 对于多次修改先给git打上tag如下:
    git commit -m Release 0.0.1
    git tag 0.0.1
    git push --tags  
    git push origin master
  6. 验证podspec如下:
    pod lib lint --allow-warnings 
    或者pod lib lint XXXX.podspec --allow-warnings
  7. 如果一切顺利会出现MyPodDemo passed validation. ,恭喜你
  8. 如果有错误和警告会不通过,你可以对应修改相关错误,警告可以用--allow-warnings忽略

最后一步trunk到cocoPods

pod trunk push XXXX.podspec
成功可以使用:pod search命令查找你的库了

如图在使用pod search过程中失败, 或出现这类字样:
[!] Unable to find a pod with name, author, summary, or descriptionmatching LLLaunchAd,
请参考这篇文章解决

效果图

LLLaunchAd
LLLaunchAd
LLLaunchAd

LLLaunchAd介绍

可以使用 pod 'LLLaunchAd', '~> 1.0.0' ,加载启动广告LLLaunchAd到你的项目中, 使用介绍参考我的LLLaunchAd

写在结尾

  • 过程其实很简单也不繁琐,最重要的还是要自己实现一遍
  • 有问题可以联系我QQ578545715

Latest podspec

{
    "name": "LLLaunchAd",
    "version": "1.0.0",
    "summary": "A iOS LaunchAd show of MyPodDemo.",
    "homepage": "https://github.com/LeeFengHY/MyPodDemo",
    "license": "MIT",
    "authors": {
        "LeeFengHY": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/LeeFengHY/MyPodDemo.git",
        "tag": "1.0.0"
    },
    "source_files": "LLLaunchAd/*.{h,m}",
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "requires_arc": true,
    "xcconfig": {
        "HEADER_SEARCH_PATHS": "$(SDKROOT)/usr/include/libxml2"
    }
}

Pin It on Pinterest

Share This