Search code examples
iosobjective-cuiactivityviewcontrolleruiactivity

Ho do I get to know whether specific app is installed on user device?


My goal is to create custom UIActivities for Google+, Pinterest and LinkedIn for social share. And my custom activities should appear in UIActivityViewController only if native apps are absent (aren't installed - means native share won't appear in UIActivityViewController).

But I don't know how to check whether these apps are installed Is there any possibilities for this?


Solution

  • You have to know the URL Scheme to access the app by canOpenURL like:

    NSURL *likedInURL = [NSURL URLWithString:@"linkedin://profile?id=[id]"];
    if ([[UIApplication sharedApplication] canOpenURL: likedInURL]) {
        [[UIApplication sharedApplication] openURL: likedInURL];
    } else {
        // There is no app installed
    }
    

    Take a look here for more schemes: http://pureoxygenlabs.com/10-app-url-schemes-for-marketers/

    I hope this can help you.