2011-11-22 77 views
1

我需要將我iPhone應用中的用戶帖子分享到Google +。我做了Facebook和Twitter分享。Google Plus從iphone分享

谷歌+是否有API?有沒有人有任何例子?

+0

[Google plus api for posting on wall like facebook](http://stackoverflow.com/questions/7857812/google-plus-api-for-posting-on-wall-like-facebook) –

回答

0

現在他們沒有任何API我想他們很快就會介紹我希望能幫到你。 但現在不行。

+0

This似乎不是正確的答案。你必須已經添加它作爲評論 –

1

的分享對谷歌的職位最簡單的方法是加首先包括在Xcode其GPPShare.h文件,然後用GPPShareDelegate 延長.h文件然後在IBAction爲方法

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

寫這個代碼,同時也實現GPPShareDelegate方法,它是有幫助的,以檢測成功共享

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

當我實現這種方法..我有一個控制檯輸出,我必須先登錄。我怎樣才能做到這一點 – Dalvik

3

對於雨燕3.0

import SafariServices 

然後在共享按鈕添加以下代碼委託

<SFSafariViewControllerDelegate> 

使用本

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) 

這是一個簡單的G +份額現已上市。