LoginSignup
0
0

More than 1 year has passed since last update.

LicensePlistにハマったので備忘録

Posted at

はじめに

アプリの設定画面に使用しているライセンスの一覧を表示するのに便利なpodsを使用してLicensePlistを導入する方法で少しつまづいたので備忘録。

LicensePlistの導入手順

①podfileに以下を追加する。

pod 'LicensePlist'

②XcodeのTargets > Build Phases > Run Scriptに以下を追加する。

if [ $CONFIGURATION = "Debug" ]; then
cd $SRCROOT
/usr/local/bin/license-plist --output-path $PRODUCT_NAME/Settings.bundle
fi

✂︎✂︎✂︎✂︎ここで作業終わりかと勘違いしていました。これだけじゃ設定に表示されませんね・・・✂︎✂︎✂︎✂︎

③Setting.bundleをプロジェクトに追加して、Root.plistを編集する。
プロジェクトによりますがLicensePlistに関連するのは以下図のItem0
スクリーンショット 2021-06-28 20.02.01.png

項目名 入力値
Type Child Pane
Title Licenses(設定画面で表示したいタイトル名)
Filename com.mono0926.LicensePlist

④以下のコマンドを実行

$ cd <プロジェクトルート>
$ ./Pods/LicensePlist/license-plist

コマンドを実行すると「com.mono0926.LicensePlist.Output」というフォルダが増えます。

⑤④で増えたフォルダ内のファイル全てを③で作成したSetting.bundle配下に追加します。
追加すると以下のような表示になります。
スクリーンショット 2021-06-28 20.01.41.png

⑥ビルドして確認すると設定画面に無事、ライセンスが表示されているのが確認できます。

参考サイト

0
0
2

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
0
0