LoginSignup
5
2

More than 5 years have passed since last update.

Cocoa Podsでライブラリを公開するときにpodspec設定で躓いたところ

Last updated at Posted at 2018-03-01

導入

ライブラリを公開するときにpod lib lint 【podspecファイル名】でチェックすると思います。
そのときにデフォルトのままだと大量のエラーが出たのでその時に対処したことを記述していきます。

今回サンプルに使うライブラリ
https://github.com/HideakiTouhara/TinderCard
(スターも押して頂けると嬉しいです)

対処したこと一覧

一つずつ挙げていきます。

- ERROR | attributes: Missing required attribute `summary`.

podspecのファイルの中のsummaryはデフォルトでは設定されていませんが、必須項目です。
podspecファイルを開いてs.summaryにライブラリの概要を記入しましょう。

  s.summary      = "Use tinde like UI instantly."

- WARN | description: The description is equal to the summary. もしくは - ERROR | description: The description is empty.

先ほどと同じ要領でdescriptionにも文言を設定していきましょう。
summaryと文言は違ったもので設定しましょう。

  s.description  = <<-DESC
           - You can implement tinder UI like tableView.
                   DESC

- ERROR | license: Sample license type.

Licenseのタイプとファイルを指定しましょう。
github上でレポジトリを作成する際にライセンスを作成しておくのが良いと思います。
MITなら以下でいけます。

s.license      = { :type => "MIT", :file => "LICENSE" }

- ERROR | file patterns: The `source_files` pattern did not match any file.

ライブラリに使うソースのパスを正しく指定します。
サンプルの場合はこんな感じです。

  s.source_files  = "TinderCard/**/*.swift"

- WARN | swift_version: The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a `.swift-version` file to set the version for your Pod. For example to use Swift 2.3, run:

使用するSwiftのバージョンをechoしてほしいと言っています。
コマンド上から実行します。
自分は以下のようにしました。

echo "4.0" > .swift-version

platform

エラー内容は忘れましたが、platformも指定します。

  s.platform     = :ios, "10.0"

完成

以上であとはpod trunk push 【podspecファイル名】で公開完了です!

もしかしたら他にも指定しなければならない項目があるかもしれませんが、そのときはhttps://github.com/HideakiTouhara/TinderCardTinderCard.podspecがあるので参考にして頂ければと思います。

Cocoa Podsで公開するための資料

https://qiita.com/s0hno/items/d1600457dce94ec635be
https://qiita.com/taji-taji/items/e23373f9b8124de728a2

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2