IOS Detailed Explanation of the Method of Obtaining Current Version Number Bundle ID and Other Information

  • 2021-08-17 01:15:23
  • OfStack

Method for IOS to obtain information such as current version number Bundle ID

1: Obtain bundle Id information: [[NSBundle mainBundle] bundleIdentifier];

2: Get the version number: [[[NSBundle mainBundle] infoDictionary] objectForKey: @ "CFBundleShortVersionString"];

3: Get build number: [[[NSBundle mainBundle] infoDictionary] objectForKey: @ "CFBundleVersion"];

4: Get the App display name: [[[NSBundle mainBundle] infoDictionary] objectForKey: @ "CFBundleDisplayName"];

In fact, [[NSBundle mainBundle] infoDictionary] gets a dictionary, which contains all kinds of information in Info. plist file, according to different keys, such as:


 CFBundleDevelopmentRegion 

  CFBundleDisplayName 

  CFBundleExecutable

  CFBundleExecutablePath

  CFBundleIdentifier

  CFBundleInfoDictionaryVersion = "6.0";

  CFBundleInfoPlistURL

  CFBundleName

  CFBundlePackageType 

  CFBundleShortVersionString

  CFBundleSignature 

 CFBundleSupportedPlatforms

Thank you for reading, hope to help everyone, thank you for your support to this site!


Related articles: