(iOS, XCode 4.2) Setting bundle version using Git post-commit hook causes my project to turn into a Mac project

时间:2022-10-14 00:24:37

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).

我决定开始将我的项目“Apple方式”开始版本化,使用“Bundle versions string,short”用于我的项目的“营销版本”(即2.0.1),并将“Bundle version”用作版本号(例如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.

为此,我添加了一个Git post-commit钩子来调用agvtool next-version -all。实际上这确实有效 - Info.plist正在使用递增的版本号进行适当更新。

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.

然而,它还有一个令人遗憾的副作用,显然是将我的iOS项目转换为Mac项目 - iOS设备,iPhone 5.0模拟器等从我的Scheme菜单中消失,用一个条目My Mac 64位替换。幸运的是,这一变化似乎是暂时的,因为退出并重新启动Xcode会带回缺少的iOS方案条目。

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?

我做错了吗?有没有更好的方法来实现我的目标?或者我遇到了Xcode中一个奇怪的错误?

3 个解决方案

#1


4  

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我只是在目标选项的Summary选项卡中重新选择Deployment Target。这要快得多。

#2


1  

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.

XCode 4尝试在每次更改时解析项目文件,而不是XCode 3.2,它只在程序本身获得焦点时解析项目文件。

I wouldn't call it a bug per se, but it certainly makes for a frustrating experience.

我不会把它称之为bug本身,但它肯定会让人感到沮丧。

#3


1  

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.

Fwiw,我已经看到在连接或断开我的iDevice AND时这种方案发生了这种情况,而Xcode考虑我已经做了什么,弄乱了方案菜单。关闭并重新打开项目会修复它。

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.

我通常会在提交之前确保我的项目文件已关闭。如果我的post-commit脚本也修改了项目文件,我肯定会这样做。

#1


4  

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我只是在目标选项的Summary选项卡中重新选择Deployment Target。这要快得多。

#2


1  

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.

XCode 4尝试在每次更改时解析项目文件,而不是XCode 3.2,它只在程序本身获得焦点时解析项目文件。

I wouldn't call it a bug per se, but it certainly makes for a frustrating experience.

我不会把它称之为bug本身,但它肯定会让人感到沮丧。

#3


1  

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.

Fwiw,我已经看到在连接或断开我的iDevice AND时这种方案发生了这种情况,而Xcode考虑我已经做了什么,弄乱了方案菜单。关闭并重新打开项目会修复它。

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.

我通常会在提交之前确保我的项目文件已关闭。如果我的post-commit脚本也修改了项目文件,我肯定会这样做。