打开链接以关注iOS应用中的Google Plus页面?

时间:2014-05-29 06:59:37

标签: ios iphone objective-c ios7 google-plus

我想从iOS 7应用程序打开我的g +页面。类似于我们在Facebook和Twitter下面做的事情

- (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];
}

1 个答案:

答案 0 :(得分:1)

// 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];