自己的庫上傳到pod詳細步驟

自己的庫上傳到pod詳細步驟

1:利用pod在桌面創建一個工程

cd 到桌面然后 執行如下命令行:

命令行:pod lib create XFPodTest
pod創建工程具體步驟選項如下:

What is your class prefix? (工程前綴,這個可以根據自己需求隨意寫)

此時會在桌面出現通過pod 創建的工程

2:在GitHub中創建一個XFPodTest的項目

具體步驟如下圖所示:


GitHub創建項目具具體步驟
3:把本地創建的XFPodTest通過git上傳到GitHub倉庫
1  git init
2  git commit -m "first commit"
3  git remote add origin https://github.com/xufengbj/XFPodTest.git
4  git push -u origin master
倉庫項目目錄
4:編輯.podspec文件
#
# Be sure to run `pod lib lint XFPodTest.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             = 'XFPodTest'
  s.version          = '0.1.0'
  s.summary          = 'A short description of XFPodTest.'

# 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/xufengbj/XFPodTest'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'xufengbj' => 'xufeng@zhuomogroup.com' }
  s.source           = { :git => 'https://github.com/xufengbj/XFPodTest.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'

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

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end
  • s.summary = 'A short description of XFPodTest.' 這里最好寫上描述不要用默認描述否則后面的驗證會有提示錯誤
5:驗證.podspec文件是否合法
pod lib lint XFPodTest.podspec
6:提交自己的pod
  • 設置tag
git tag 0.1.0
git push origin 0.1.0
  • 驗證.podspec文件是否合法
pod lib lint XFPodTest.podspec
  • 提交pod到specs倉庫
pod trunk push XFPodTest.podspec
出現    Updating spec repo `master`
--------------------------------------------------------------------------------
    ??  Congrats
    ??  Tell your friends!

    --------------------------------------------------------------------------------
    即表示提交成功
  • 驗證是否提交成功
    pod search XFPodTest
上傳成功截圖

一:pod上傳自己的庫是通過trunk進行上傳的再上傳之前需要注冊一個CocoaPod賬號,通過總得注冊的方式如下:

pod trunk register 郵箱地址 '用戶名' --verbose

按Enter鍵之后會發一個確認郵件到你的郵箱上,注意查收郵件并進行驗證確認。

注冊成功之后 然后再終端輸入

pod trunk me
可以看到注冊的信息

注冊詳情

二:查看倉庫Owner

看看現在倉庫的Owner屬于xufengbj賬戶(這個XFPodTest是唯一的根據自己的庫然后查找相應的倉庫Owner)

XFPodTest
    - Versions:
      - 0.1.0 (2018-09-07 09:22:48 UTC)
    - Owners:
    - xufengbj <xufeng@zhuomogroup.com>
  • 添加一個賬戶
trunk add-owner XFPodTest 1192936115@qq.com
  • 刪除一個賬戶
trunk remove-owner XFPodTest 1192936115@qq.com

三:自己的庫上傳到pod詳細步驟中可能會出現問題一下是一些命令用于查找原因供解決。

  • git查找自己的用戶名和郵箱
git config user.name
git config user.email
  • git修改自己的用戶名和郵箱
git config --global user.name 'xxx'
git config --global user.email 'xxx'

以上一 二 三 是可能再上傳過程中會遇到的一些問題 可以根據相應提示錯誤進行查詢找到問題然后修改。

四:Unable to find a pod with name, author, summary, or description matching XFPodTest

刪除~/Library/Caches/CocoaPods目錄下的search_index.json文件
然后再pod search 即可。

郵箱:1192936115@qq.com
以上是我郵箱有問題可以發我郵箱或者叫我QQ進行溝通交流。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容