Apple Application Info

From Qt Wiki
(Redirected from IOS Application Info)
Jump to: navigation, search

General

The most of information you could get from Info.plist. This file you could use to configuration your application. In this file you could set icon and splash screen, add file sharing, custom URL protocol etc. For more information about this file you could find in official documentation here.

If you want to print all fields from Info.plist you could use something like this: NSLog(@"Info.plist content: %@", [[NSBundle mainBundle] infoDictionary]);

Also you can add custom fields to Info.plist and get access to it with key name which you set for example: //Get value of property with name 'custom_key' QString str = QString::fromNSString([[[NSBundle mainBundle] infoDictionary] objectForKey:@"custom_key"]);


Application Short Version

QString str = QString::fromNSString([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]);

SDK Build

QString str = QString::fromNSString([[[NSBundle mainBundle] infoDictionary] objectForKey:@"DTSDKBuild"]);

Xcode information

QString str = QString::fromNSString([[[NSBundle mainBundle] infoDictionary] objectForKey:@"DTXcode"]); QString xcodeBuild = QString::fromNSString([[[NSBundle mainBundle] infoDictionary] objectForKey:@"DTXcodeBuild"]);

Minimum OS Version

The minimum version of macOS where your application can be installed. QString str = QString::fromNSString([[[NSBundle mainBundle] infoDictionary] objectForKey:@"LSMinimumSystemVersion"]); The minimum version of iOS, tvOS, or watchOS where your application can be installed. QString str = QString::fromNSString([[[NSBundle mainBundle] infoDictionary] objectForKey:@"MinimumOSVersion"]);

Check Application In AppStore

This code you can use if you need to detect when application was installed to device from AppStore. #if !TARGET_OS_SIMULATOR

   if([[NSBundle mainBundle] pathForResource:@"embedded"
                                      ofType:@"mobileprovision"])
   {
       return false;
   }
   else
   {
       return true;
   }
  1. else
   return false;
  1. endif

File Sharing Enabled

If this flag is true your application supported upload file from iTunes. bool flag = ([[[[NSBundle mainBundle] infoDictionary] objectForKey:@"UIFileSharingEnabled"] boolValue] == YES) ? true : false;

Supported Interface Orientations

List of supported interface orientations. This list can be different for iPad and iPhone. NSArray* array = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]; NSString* platformsString = [array componentsJoinedByString:@"|"]; QString str = QString::fromNSString(platformsString).split("|");