バージョン番号表示
Settings.bundleを追加
プロジェクトのトップを選択。(Settings.bundleがプロジェクト直下に作成される。)
File -> New -> File... -> Settings Bundleを選択。
Settings.bundleの中のRoot.plistを以下のように編集。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>About</string>
</dict>
<dict>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>Title</key>
<string>Version</string>
<key>Key</key>
<string>name_preference</string>
<key>DefaultValue</key>
<string></string>
</dict>
<dict>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>File</key>
<string>Acknowledgements</string>
</dict>
</array>
</dict>
</plist>
Run Scriptを追加


Run Script
version=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$PROJECT_DIR/$INFOPLIST_FILE")
build=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$PROJECT_DIR/$INFOPLIST_FILE")
/usr/libexec/PlistBuddy -c "Set PreferenceSpecifiers:1:DefaultValue $version ($build)" "$CODESIGNING_FOLDER_PATH/Settings.bundle/Root.plist"
参考:https://stackoverflow.com/a/39030153
Cocoapodsで導入したライブラリのライセンス表記
pod installを実行後、どこにacknowledgements.plistが作成されているかを確認します。
Pods/Target Support Files/Pods-[Target]/Pods-[Target]-Acknowledgements.plist
Podfileに以下を記載します。
post_install do | installer |
require 'fileutils'
FileUtils.cp_r('Pods/Target Support Files/Pods-[Target]/Pods-[Target]-Acknowledgements.plist', 'Settings.bundle/Acknowledgements.plist', :remove_destination => true)
end