(iOS,XCode 4.2)使用 Git post-commit hook 设置捆绑版本会导致我的项目变成 Mac 项目
我决定开始以“Apple 方式”对我的项目进行版本控制,使用“捆绑版本字符串,短”作为我项目的“营销版本”(即 2.0.1
),并使用“捆绑版本” " 作为内部版本号(例如 42
)。
为此,我添加了一个 Git post-commit
挂钩来调用 agvtool next-version -all
。这实际上确实有效 - Info.plist
正在使用递增的版本号进行正确更新。
然而,它也有一个不幸的副作用,即显然将我的 iOS 项目转换为 Mac 项目 - iOS 设备
、iPhone 5.0 模拟器
等从我的 Scheme 中消失
菜单将替换为单个条目,My Mac 64-bit
。幸运的是,这种更改似乎是暂时的,因为退出并重新启动 Xcode 会恢复丢失的 iOS 方案条目。
我这样做错了吗?有更好的方法来实现我的目标吗?或者我在 Xcode 中遇到了奇怪的错误?
I've decided to start versioning my project "the Apple way," using "Bundle versions string, short" for the "marketing version" (i.e. 2.0.1
) of my project, and "Bundle version" as a build number (e.g. 42
).
To that end I've added a Git post-commit
hook to call agvtool next-version -all
. This does in fact work -- Info.plist
is being properly updated with an incrementing version number.
However it also has the unfortunate side effect of apparently converting my iOS project into a Mac project -- iOS device
, iPhone 5.0 simulator
, etc. disappears from my Scheme
menu to be replaced with a single entry, My Mac 64-bit
. Fortunately this change appears to be temporary, as quitting and relaunching Xcode brings back the missing iOS scheme entries.
Am I doing this wrong? Is there a better way of accomplishing my goals? Or have I run up against a weird bug in Xcode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了完全相同的问题,但我没有重新启动 Xcode,而是在目标选项的 Summary 选项卡中重新选择部署目标。这要快得多。
I'm having exactly the same problem, but instead of relaunching Xcode I'm just re-selecting Deployment Target in Summary tab in target options. This is much faster.
XCode 4 在每次更改时都会尝试解析项目文件,而 XCode 3.2 仅在程序本身获得焦点时才解析项目文件。
我不会将其称为错误本身,但它确实会带来令人沮丧的体验。
XCode 4 tries to parse the project file every time it changes, as opposed to XCode 3.2 which only parsed the project file when the program itself received focus.
I wouldn't call it a bug per se, but it certainly makes for a frustrating experience.
Fwiw,当连接或断开我的 iDevice 时,我已经看到这种情况发生在方案中,并且当 Xcode 思考我所做的事情时,方案菜单会变得混乱。关闭并重新打开项目即可修复该问题。
我通常会确保在提交项目文件之前关闭它们。如果我的提交后脚本也在修改项目文件,我肯定会这样做。
Fwiw, I've seen this kind of thing happen with the schemes when connecting or disconnecting my iDevice AND, while Xcode thinks about what I've done, mess with the scheme menu. Closing and re-opening the project fixes it.
I usually make sure that my project files are closed before I commit them. I would certainly do this if my post-commit script were also modifying the project file.