在启用了资源库的情况下,在Xcode 5中修改Info.plist的CFBundleVersion [英] Modifying Info.plist's CFBundleVersion in Xcode 5 with Asset Library enabled

查看:287
本文介绍了在启用了资源库的情况下,在Xcode 5中修改Info.plist的CFBundleVersion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

借助Xcode 5的新资产库,添加图像和组织图像从未如此简单.但是,似乎它破坏了我用于创建版本的某些脚本.

With Xcode 5's new Asset Library, adding images and organizing them has never been easier. However, it seems as if it has broken some scripts I use for creating builds.

我在运行脚本阶段"中有一个脚本,该脚本将CFBundleVersion设置为plist中的当前时间戳.在脚本中,我执行以下语句:

I have a script within my Run Script Phase that sets the CFBundleVersion to be the current timestamp within the plist. In the script, I execute this statement:

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $timestamp" $BUILT_PRODUCTS_DIR/$INFOPLIST_PATH

但是,当执行该命令时,将显示以下语句:

However, when this gets executed, the following statement displays:

Set: Entry, ":CFBundleVersion", Does Not Exist
File Doesn't Exist, Will Create: /Users/SpacePyro/Library/DerivedData/BundleTest-duikdqngfmrovnagrcsvdcuxxstz/Build/Products/Debug-iphoneos/BundleTest.app/Info.plist

这似乎是在干净的版本上发生的.该plist似乎直到构建的中途才生成,这可能是由于资产库造成的.

It seems like this happens on clean builds. The plist doesn't seem to get generated until midway through the build, presumably due to the Asset Libraries.

我也使用了此命令,尽管它不会引发错误,但仍然会丢失我的更改(假设INFO_PLIST="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/Info"):

I've also used this command, and while it doesn't throw the error, it still blows away my changes (assume INFO_PLIST="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/Info"):

defaults write $INFO_PLIST CFBundleVersion $timestamp

当我开始使用资产库来组织我的应用程序图标和启动图像时,情况并非如此.有人知道为什么会这样吗?更好的是,是否有解决方法可将此值添加到plist中?我已经尝试过将脚本置于操作前构建阶段以及操作后构建阶段.我还尝试在构建完成后运行该命令,但是当我尝试对它进行代码签名和打包时,它说签名由于plist修改而无效.

This used to not be the case when I started using the Asset Library to organize my app icons and splash images. Anyone know why this happens? And better yet, is there a workaround to add this value to the plist? I've already tried placing the script in a pre-action build phase, as well as the post-action build phase. I've also tried running the command after the build has completed, but when I try to codesign and package it up, it says that the signature is invalid due to plist modification.

如果没有合理的解决方案,我想我可以随时从Asset Libraries迁移,直到我的脚本可以工作为止.

If no reasonable solution exists, I guess I could always de-migrate from Asset Libraries until I can get my scripts to work.

推荐答案

弄清楚了这一点,这很愚蠢.事实证明,您可以将脚本阶段移到最后.我什至不知道这些东西是可移动的,或者那很重要!但是通过将运行脚本"阶段拖到底部,脚本可以根据需要运行和修改内容.

Figured this one out, and it was a silly one. Turns out you can just move the script phase to the very end. I didn't even know these were movable, or that it mattered! But by dragging the Run Script phase to the bottom as such, the scripts were able to run and modify things as needed.

这篇关于在启用了资源库的情况下,在Xcode 5中修改Info.plist的CFBundleVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆