Jon
Jon

Reputation: 4732

How To Get App Version Number From User?

I want to log the app version number so when user sends feedback, it will be in the email.

How can I get the number?

Upvotes: 11

Views: 1284

Answers (2)

user1125761
user1125761

Reputation: 1

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]

Upvotes: 0

Praveen S
Praveen S

Reputation: 10393

NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
NSString* versionNum = [infoDict objectForKey:@"CFBundleVersion"];
NSString *appName = [infoDict objectForKey:@"CFBundleDisplayName"];
NSString *text = [NSString stringWithFormat:@"%@ %@",appName,versionNum];

You can send both the appname and version number using this code.

Upvotes: 20

Related Questions