Apple Application Info: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Gather iOS pages into a category)
m (Jake Petroules moved page IOS Application Info to Apple Application Info: Details all Apple platforms)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[Category:iOS]]
[[Category:iOS]]
[[Category:macOS]]
[[Category:tvOS]]
[[Category:watchOS]]
== General ==
== 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 [https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW4 here].
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 [https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW4 here].
Line 23: Line 26:


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


== Check Application In AppStore ==
== Check Application In AppStore ==
This code you can use if you need to detect when application was installed to device from AppStore.
This code you can use if you need to detect when application was installed to device from AppStore.
<code>#if !TARGET_IPHONE_SIMULATOR
<code>#if !TARGET_OS_SIMULATOR
     if([[NSBundle mainBundle] pathForResource:@"embedded"
     if([[NSBundle mainBundle] pathForResource:@"embedded"
                                       ofType:@"mobileprovision"])
                                       ofType:@"mobileprovision"])

Latest revision as of 20:30, 16 February 2017

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("|");