Skip to content
Blog iOS: How to get App’s Version number (CFBundleVersion)

iOS: How to get App’s Version number (CFBundleVersion)

 
Recently, i had to make an update to one of my apps. I was trying to figure out a way to see if all the users have upgraded their app. I made the app to get the current version number and send it to the server.

Here is, how you can get the current version number of the app.

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

infoDictionary returns a dictionary, constructed from the bundle’s Info.plist file, that contains information about the receiver. If the bundle does not contain an Info.plist file, a valid dictionary is returned but this dictionary contains only private keys that are used internally by the NSBundle class.

Similarly, to get the name of the app use:

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

🙂

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.