vks
vks

Reputation: 7071

Google Plus Sharing from iphone

I need to share users posts from my iphone app to google+. I did facebook and twitter share.

Does google+ have an API for this? Does anyone have any examples?

Upvotes: 0

Views: 4843

Answers (6)

ak_ninan
ak_ninan

Reputation: 781

For Swift 3.0

import SafariServices

then add the delegate

<SFSafariViewControllerDelegate>

use this below code in the share button

var urlComponents = URLComponents(string:"https://plus.google.com/share")
let queryItem = URLQueryItem(name: "url", value: "https://myexamplepagetoshare.com")
urlComponents?.queryItems = [queryItem]
let url = urlComponents?.url
let safariVC = SFSafariViewController(url: url!)
safariVC.delegate = self
self.present(safariVC, animated: true, completion: nil)

This is the simple G+ share that's available now.

Upvotes: 3

Gami Nilesh
Gami Nilesh

Reputation: 581

I integrated Google plus sharing. Please see this code. https://www.dropbox.com/s/o0bwtzgbpobsjkq/Share.zip?dl=0

Upvotes: 0

The easiest way of sharing the posts on google plus is to first include its GPPShare.h file in xcode and then extend the .h file with GPPShareDelegate And then write this code in the IBAction method

id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];
// This line will manually fill out the title, description, and thumbnail of the
// item you're sharing.
[shareBuilder setTitle:@"Share" description:@"sharing" thumbnailURL:[NSURL  URLWithString:@"http://25.media.tumblr.com/tumblr_m9p3n1vJmZ1rexr16o1_400.jpg"]];
[shareBuilder setContentDeepLinkID:@"rest=1234567"];
[shareBuilder open];

and also implement GPPShareDelegate method which is helpful in order to detect the successful sharing

 - (void)finishedSharing:(BOOL)shared
  {    if (shared) {
      NSLog(@"User successfully shared!");
   } else {
   NSLog(@"User didn't share.");
 }

Upvotes: 1

Chirag Shah
Chirag Shah

Reputation: 3674

You use the Google+ share link: https://developers.google.com/+/plugins/share/#sharelink

"The share link is intended for native client applications... and others who may not be able to use the +1 or share button"

Upvotes: 0

Aakil Ladhani
Aakil Ladhani

Reputation: 982

Here is the link for the API of Google plus: https://developers.google.com/+/api/

& here is the link where u can find help for sharing in google plus http://code.google.com/p/google-api-objectivec-client/wiki/Introduction

Upvotes: 3

Harish
Harish

Reputation: 544

Right now they don't have any API I think.They are soon going to introduce .I hope help you. But not now.

Upvotes: 0

Related Questions