How to open the LinkedIn App from your own iOS App

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.





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.