(iOS, XCode 4.2) Setting bundle version using Git

2019-05-12 13:06发布

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?

3条回答
Anthone
2楼-- · 2019-05-12 13:22

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.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-05-12 13:23

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.

查看更多
萌系小妹纸
4楼-- · 2019-05-12 13:37

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.

查看更多
登录 后发表回答