我正在尝试编写一个运行脚本来更新 Root.plist 中的版本。 这是脚本
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 是
<?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>
我已按照 this 中的说明进行操作回答。当我创建 .ipa 时版本号更新成功,我可以在 iTunes 中看到新版本。但是当我尝试升级应用程序时,设备显示“1 项无法同步。有关详细信息,请参阅 iTunes'。但是,如果删除手机上的旧应用程序并进行全新安装,则该应用程序会成功安装并且手机设置中会出现正确的版本。我使用的是 xcode 4.5.2 谁能帮忙
最佳答案
以下脚本用于将当前的 subversion 修订号插入到我们的 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
关于iphone - 设置包中的更新版本失败 iphone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14216035/