How to open the LinkedIn App from your own iOS App

- by

Here’s a sample action that tries to open a LinkedIn Profile with the LinkedIn App. If it’s not installed, it opens a link to the profile in Safari. If that doesn’t work it gives a log message (please handle appropriately in your own code):

- (IBAction)openLinkedIn:(id)sender {
    
    // open the LinkedIn App
    if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"linkedin://#profile/35932112"]]) {
        
        // opening the app didn't work - let's open Safari
        if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.linkedin.com/company/pinkstone-pictures"]]) {
            
            // nothing works - perhaps we're not onlye
            NSLog(@"LinkedIn doesn't works. Punt.");
        }
    }
}

Note that currently you can only link to personal profiles, not to company profiles.

To create a dynamic web button with follower count (or not), check out the LinkedIn Developer Portal and load the code into a small UIWebView.

At the time of writing it appears that none of the LinkedIn provided plugins are actually working anywhere other than the preview. Looks like we’ll have to use a standard graphic instead until this is fixed.



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.