I'm writing an iPhone app. It's already been published, but I would like to add a feature where its version number is displayed.
I'd rather not have to do this manually with each version I release...
Is there a way in objective-C to find out what the version is of my app?
As I describe here, I use a script to rewrite a header file with my current Subversion revision number. That revision number is stored in the kRevisionNumber constant. I can then access the version and revision number using something similar to the following:
[NSString stringWithFormat:@"Version %@ (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"], kRevisionNumber]
which will create a string of the format "Version 1.0 (51)".