Inherits from NSObject
Declared in iHasApp.h

Overview

The iHasApp class is used to perform on-device app detection. It can return detected appIds, or perform additional API calls and return detected appDictionaries.

See http://www.iHasApp.com/ for information and updates.

Requirements: iOS base SDK 5.0+, Internet connectivity

Tasks

Properties

  •   country

    The two-letter country code for the store you want to search. The search uses the default store front for the specified country. Default is [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode].

    property

Detection Methods

Informational Methods

Properties

country

The two-letter country code for the store you want to search. The search uses the default store front for the specified country. Default is [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode].

@property (nonatomic, strong) NSString *country

Discussion

See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes.

//To determine device-specific country codes, use:
NSString *countryCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];

Declared In

iHasApp.h

Instance Methods

detectAppDictionariesWithIncremental:withSuccess:withFailure:

Starts an appDictionary detection process.

- (void)detectAppDictionariesWithIncremental:(void ( ^ ) ( NSArray *appDictionaries ))incrementalBlock withSuccess:(void ( ^ ) ( NSArray *appDictionaries ))successBlock withFailure:(void ( ^ ) ( NSError *error ))failureBlock

Parameters

incrementalBlock

The block invoked after a chunk of appDictionaries are detected.

successBlock

The block invoked after all possible appDictionaries are detected.

failureBlock

The block to invoke if the access operation fails—for example, if there is a network error.

Discussion

iHasApp *detectionObject = [[iHasApp alloc] init];
[detectionObject detectAppDictionariesWithIncremental:^(NSArray *appDictionaries) {
    NSLog(@"Incremental appDictionaries.count: %i", appDictionaries.count);
} withSuccess:^(NSArray *appDictionaries) {
    NSLog(@"Successful appDictionaries.count: %i", appDictionaries.count);
} withFailure:^(NSError *error) {
    NSLog(@"Failure: %@", error.localizedDescription);
}];

Declared In

iHasApp.h

detectAppIdsWithIncremental:withSuccess:withFailure:

Starts an appId detection process.

- (void)detectAppIdsWithIncremental:(void ( ^ ) ( NSArray *appIds ))incrementalBlock withSuccess:(void ( ^ ) ( NSArray *appIds ))successBlock withFailure:(void ( ^ ) ( NSError *error ))failureBlock

Parameters

incrementalBlock

The block invoked after a chunk of appIds are detected.

successBlock

The block invoked after all possible appIds are detected.

failureBlock

The block to invoke if the access operation fails—for example, if there is a network error.

Discussion

iHasApp *detectionObject = [[iHasApp alloc] init];
[detectionObject detectAppIdsWithIncremental:^(NSArray *appIds) {
    NSLog(@"Incremental appIds.count: %i", appIds.count);
} withSuccess:^(NSArray *appIds) {
    NSLog(@"Successful appIds.count: %i", appIds.count);
} withFailure:^(NSError *error) {
    NSLog(@"Failure: %@", error.localizedDescription);
}];

Declared In

iHasApp.h

retrieveAppDictionariesForAppIds:withSuccess:withFailure:

Returns the associated App Store information for the desired apps.

- (void)retrieveAppDictionariesForAppIds:(NSArray *)appIds withSuccess:(void ( ^ ) ( NSArray *appDictionaries ))successBlock withFailure:(void ( ^ ) ( NSError *error ))failureBlock

Parameters

appIds

An array of appIds you want to search for on the iTunes App Store.

successBlock

The block invoked after the search successfully returns.

failureBlock

The block to invoke if the search operation fails—for example, if there is a network error.

Discussion

This is used internally to convert appIds to appDictionaries.

Data returned is from the iTunes Search API. (e.g: http://itunes.apple.com/lookup?id=284882215 )

Declared In

iHasApp.h