问题
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?
回答1:
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.
回答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.
回答3:
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.
来源:https://stackoverflow.com/questions/7731589/ios-xcode-4-2-setting-bundle-version-using-git-post-commit-hook-causes-my-pro