わかりました、私もこの問題を抱えていました。解決策(一種)は、デフォルト値フィールドを提供し、それに値を与えることでした。これは実際にはドキュメントに明示的に記載されています。デフォルト値はTitleプロパティの必須フィールドであるため、指定しないと、タイトルは設定ペインに表示されません。残念ながら、一度設定すると、おそらく設計どおりに値を変更できないようです。ドキュメントには、読み取り専用のプロパティであるとも記載されています。私が試しようとしている解決策は、新しいビルドを作成するたびに、Root.plistファイルにバージョン番号を明示的に入れることです。SUPERは理想的ではありませんが、うまくいくと思います。
編集:設定バンドルのバージョン番号の更新に関するこの投稿をチェックしてください
編集:わかりました、これは機能しました(上記の投稿のおかげで、bashスクリプトを少しハッキングしましたが、ほとんど経験がありませんでした)。これがスクリプトです(「スクリプトの実行」ビルドでインラインで記述しました)。段階):
#!/bin/bash
builtInfoPlistPath=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}
#increment the build number
buildNumber=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$builtInfoPlistPath")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$builtInfoPlistPath"
#compose the version number string
versionString=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$builtInfoPlistPath")
versionString+=" ("
versionString+=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$builtInfoPlistPath")
versionString+=")"
#write the version number string to the settings bundle
#IMPORTANT: this assumes the version number is the first property in the settings bundle!
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:0:DefaultValue $versionString" "Settings.bundle/Root.plist"
... 以上です!チャームのように機能します!それが私の問題を解決したので、それがあなたの問題に役立つことを願っています。現在の唯一の問題は、ビルド番号とのわずかな不一致です...
編集:...この投稿に対するvakioの2番目のコメントで修正しました。代わりに、info.plistへのパスを(スクリプトの実行フェーズの前に)すでに処理されているパスに設定します。
編集:これが私の最新バージョンです。これは外部ファイルにあり、ビルド番号を増やす前に一部のソースファイルが変更されていることを確認します。
#!/bin/bash
#note: for simplicity, it's assumed that there's already a bundle version (which is an integer) and a version string. set them in the Summary pane!
#get path to the BUILT .plist, NOT the packaged one! this fixes the off-by-one bug
builtInfoPlistPath=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}
echo "using plist at $builtInfoPlistPath"
modifiedFilesExist=false
#this is the modification date to compare to -- there's a possible bug here, if you edit the built plist directly, for some reason. probably you shouldn't do that anyways.
compModDate=$(stat -f "%m" "$builtInfoPlistPath")
for filename in *
do
modDate=$(stat -f "%m" "$filename")
if [ "$modDate" -gt "$compModDate" ]
then
modifiedFilesExist=true;
echo "found newly modified file: $filename"
break
fi
done
if $modifiedFilesExist
then
echo "A file is new, bumping version"
#increment the build number
buildNumber=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$builtInfoPlistPath")
echo "retrieved current build number: $buildNumber"
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$builtInfoPlistPath"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
#compose the version number string
versionString=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$builtInfoPlistPath")
versionString+=" ("
versionString+=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$builtInfoPlistPath")
versionString+=")"
#write the version number string to the settings bundle
#IMPORTANT: this assumes the version number is the second property in the settings bundle!
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $versionString" "Settings.bundle/Root.plist"
else
echo "Version not incremented -- no newly modified files"
fi