Apple Application Info

From Qt Wiki
Revision as of 20:30, 16 February 2017 by Jake Petroules (talk | contribs) (Jake Petroules moved page IOS Application Info to Apple Application Info: Details all Apple platforms)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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;
    }
#else
    return false;
#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("|");