Reputation: 284
How can I detect if user has an app, like echofon or twitter for mac or if user has pages, or textmate? Any suggestions?
Upvotes: 5
Views: 1458
Reputation: 1590
I have never tried the code in the above answer, but the following works for me:
if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"app-scheme://"]] ) {
NSLog(@"This app is installed.");
} else {
NSLog(@"This app is not installed.");
}
This method requires the app to have a scheme though. I don't know about the one above.
Upvotes: -2
Reputation: 7272
Use NSWorkspace's fullPathForApplication: to get an application's bundle path. If that method returns nil, the app is not installed. For example:
NSString *path = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"Twitter"];
BOOL isTwitterInstalled = (nil != path);
URLForApplicationWithBundleIdentifier is another method you may use.
Upvotes: 10