Skip to content

Instantly share code, notes, and snippets.

@zholmquist
Created March 26, 2012 19:56
Show Gist options
  • Save zholmquist/2209206 to your computer and use it in GitHub Desktop.
Save zholmquist/2209206 to your computer and use it in GitHub Desktop.
canOpenURL - check if phone has apps installed.
/*
canOpenURL
Clear App ( http://www.realmacsoftware.com/clear/ ) checks if app exsits,
then unlocks a theme based on that app. In Clear, they check if you have
Tweetbot.
Example Usage:
BOOL hasTweetbotInstalled = [self checkIfPhoneCanOpenAppUrlScheme:@"tweetbot://"];
BOOL hasFacebookInstalled = [self checkIfPhoneCanOpenAppUrlScheme:@"fb://"];
BOOL hasInstacastInstalled = [self checkIfPhoneCanOpenAppUrlScheme:@"pcast://"];
Custom URL Schemes of apps:
http://handleopenurl.com/
*/
-(BOOL) checkIfPhoneCanOpenAppUrlScheme:(NSString *) aCustomURLScheme
{
NSURL *url = [NSURL URLWithString: aCustomURLScheme];
return [[UIApplication sharedApplication] canOpenURL: url];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment