开发者

Is it possible to read the 'current project version' in the settings of an iPhone app

In my app I am using the agvtool to update the build number. I would now like to have the version of my app that appears in the settings to display this number and have it update automatically.

I have seen a few apps work around this by writing a script to ready the value开发者_Python百科 and populate the value then in the root.plist. I was wondering if there is a more elegant way of doing this.


I don't know your agvtool but the way I get my application version from the code is :

[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];

This gets the version number from the info.plist that you have to define before uploading your app to iTunesConnect, so this should be ok : you rely on a value that you have to define anyway.


You are looking for this. It includes information on how to set up and manage your marketing version and build number information. Then, when you need the build string, do something akin to the following:

NSString *marketingVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *buildNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];

self.appVersionLabel.text = [NSString stringWithFormat:@"%@.%@", marketingVersion, buildNumber];


It looks like the only way is to create a script to extract the number and update the plist file. The following site give a good description of what the script needs to contain

http://davedelong.tumblr.com/post/110448898058/incrementing-build-numbers-in-xcode

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜