質問

I am trying to write a run script that updates version in Root.plist. This is the script

version=/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $SRCROOT/AppName/AppName-Info.plist /usr/libexec/PlistBuddy "$SRCROOT/AppName/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:1:DefaultValue $version"

Root.plist in settings bundle is

<?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>PreferenceSpecifiers</key>
<array>
    <dict>
        <key>Title</key>
        <string>About</string>
        <key>Type</key>
        <string>PSGroupSpecifier</string>
    </dict>
    <dict>
        <key>DefaultValue</key>
        <string>1.0.24</string>
        <key>Key</key>
        <string>version_preference</string>
        <key>Title</key>
        <string>Version</string>
        <key>Type</key>
        <string>PSTitleValueSpecifier</string>
    </dict>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>

I have followed instructions from this answer. The version number updates successfully when I create the .ipa and I can see the new version in itunes. But when I try to upgrade the app, device shows '1 item could not be synced. See iTunes for more information'. However if the older app on phone is deleted and a fresh install is made the app installs successfully and correct version appears in phone settings.I am using xcode 4.5.2 Could anyone please help

役に立ちましたか?

解決 2

I tried again a few days later, used the script and did a clean build. Replaced existing copy in iTunes, synched, it worked!! The only step not same as previous attempt was, earlier I had deleted existing copy in iTunes library and dragged in the new one. Not very sure if that was causing the '1 item could not be synced. See iTunes for more information' message but now the correct version does appear in phone settings.

他のヒント

The following script works to insert the current subversion revision number into our plist:

G_VERSIONRP="`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString"  ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}`"
G_BUILDRP="`svnversion -n`"
G_TITLERP="MyApp v"
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:0:Title ${G_TITLERP}${G_VERSIONRP} (${G_BUILDRP})" ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Settings.bundle/Root.plist
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top