How to open the Google Plus App from your own iOS App

Google+To open a URL inside the Google+ App we need to know the Google+ URI scheme.

Instead of http:// it’s gplus:// – so if your Google+ URL in a web browser is http://plus.google.com/+WpguruTv, then you can open the same URL from your iOS App with gplus://plus.google.com/+WpguruTv

Let’s have a look at how to do this in code:

- (void)openGooglePlus {
    
    if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gplus://plus.google.com/+WpguruTv"]]) {
        
        // opening the app didn't work - let's try in Safair
        if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://http://plus.google.com/+WpguruTv"]]) {
            
            // nothing works - go watch TV
        }
    }
}

First we try to open the Google+ App using the gplus:// URI. If that’s unsuccessful we’ll open the standard http:// URI which will automatically bring up Safari.

It’s a good idea to test for network connectivity before attempting to open any URL (for example with the excellent Reachability by Tony Million).





Leave a Reply