Ankit Jain
Ankit Jain

Reputation: 1886

Open link to follow Google Plus page within iOS app?

I would like to open my g+ page from iOS 7 app. Similar to what we do for Facebook and Twitter below

- (IBAction)likeMeOnFacebook:(id)sender {
    NSURL *urlApp = [NSURL URLWithString:@"fb://profile/{Enter ID Here}"];
    [[UIApplication sharedApplication] openURL:urlApp];
}

- (IBAction)followMeOnTwitter:(id)sender {
    NSURL *urlApp = [NSURL URLWithString:@"twitter://user?screen_name={Enter ID Here}"];
    [[UIApplication sharedApplication] openURL:urlApp];
}

- (IBAction)followMeOnTwitter:(id)sender {
  // Need code to open Google Plus page
  // Help me out to find out the URL 
  NSURL *urlApp = [NSURL URLWithString:@""];
  [[UIApplication sharedApplication] openURL:urlApp];
}

Upvotes: 1

Views: 987

Answers (1)

Marlon Ruiz
Marlon Ruiz

Reputation: 1842

// Google +

NSURL *googlePlusURL = [[NSURL alloc] initWithString:@"gplus://plus.google.com/+Mypizza"];

// check if app is installed

if ( ! [[UIApplication sharedApplication] canOpenURL:googlePlusURL] ) {

    // if we get here, we can't open the Google app.

    googlePlusURL = [[NSURL alloc] initWithString:@"https://plus.google.com/+Mypizza"]; 
}
[[UIApplication sharedApplication] openURL:googlePlusURL];

Upvotes: 1

Related Questions