Skip to content

Instantly share code, notes, and snippets.

@natanavra
Last active March 5, 2016 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natanavra/f34ce08885cdc2644c8c to your computer and use it in GitHub Desktop.
Save natanavra/f34ce08885cdc2644c8c to your computer and use it in GitHub Desktop.
Testing LSApplicationQueriesSchemes
NSMutableArray *installed = [NSMutableArray array];
NSDictionary *infoPlist = [[NSBundle mainBundle] infoDictionary];
NSArray *whitelistSchemes = infoPlist[@"LSApplicationQueriesSchemes"];
for(NSString *scheme in whitelistSchemes) {
    NSURL *url = [NSURL URLWithString: [scheme stringByAppendingString: @"://"]];
    if([[UIApplication sharedApplication] canOpenURL: url]) {
        [installed addObject: scheme];
    }
}
NSLog(@"Installed apps: %@", installed);

//Testing for limit (Not limited on iOS 9, can't link against previous versions)
for(NSInteger i = 0 ; i < 100 ; i ++) {
    [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString: [NSString stringWithFormat: @"%li://", (long)i]]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment