谷歌加API用于在Facebook上张贴在墙上 [英] Google plus API for posting on wall like Facebook

查看:159
本文介绍了谷歌加API用于在Facebook上张贴在墙上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在google上搜索教程,在google plus上发布一些文字。但似乎没有。

我也尝试通过谷歌为mac和iPhone的开发者提供的文档,但找不到任何可以解决我的问题。此外,关于如何让用户登录google plus帐户的信息很少。

I have been searching for tutorials on google for posting some text on google plus. But it seems like there are none.
I have also tried to go through the docs provided by google for developers of mac and iPhone but can't find anything that will solve my problem. Also there are little information on how to get the user login to there google plus account.

我不知道如何为用户登录做什么,我是否必须使用一些GTLObject或使用UIWebView像foursquare一样用于用户登录。

I am not sure what to do for the user login, do I have to use some GTLObject or use UIWebView like foursquare for user login.

这是我经历过的文档列表。

Here is a list of docs that I had went through.

http://code.google.com/p/ google-api-objectivec-client / wiki /简介

http://code.google.com/p/google-api-objectivec-client/wiki/BuildingTheLibrary

http://code.google.com/p/gtm-oauth2/

推荐答案

事实证明,对于谷歌+开发人员来说只有有限数量的api可用,而且根据开发只有GET调用由于google正在创建用于访问Google Plus上的用户信息的新API,因此我的问题将无法获得任何明确的答案。

As it turns out there are only a limited number of api's available for google + developers and that also only as GET calls according to the developer of google + page my question will not get any definite answers as google is in the process of creating new api's for accessing user information on google plus.

https://developers.google.com/+/api/

此外,您可以使用谷歌提供的谷歌客户端sdk,但更容易显示用户登录的 webview 。我设法从google plus获取人员列表。

Also you can use the google client sdk provided by google but it is much easier to show a webview for user login. I managed to get the people list from google plus.

步骤与获取访问令牌的步骤相同,如foursquare。只需进行一些小的更改。

The steps are same as for getting the access token as in foursquare. Just with some small changes.

viewdidload 方法。

NSString *authStr = @"https://accounts.google.com/o/oauth2/auth?client_id=client_id&redirect_uri=http://somevalidurl.com&scope=https://www.googleapis.com/auth/plus.me&response_type=token";

作为webview中加载请求的URL。人们应该注意一件事,你需要在api控制台中为你的应用程序创建一个基于web的客户端ID,而不是为此目的安装,因为你不会有任何选项输入任何网站url进行回调,这对于这种情况。

as a url for loading request in webview. People should note one thing here that you need to create a client id in api console for your app that is web based and not as installed for this purpose as you wont we getting any option to enter any website url for callback which is very important in this case.

和webview委托方法 webViewDidFinishLoad:

and in webview delegate method webViewDidFinishLoad:

NSString *urlStr = [[webView.request URL] absoluteString];
NSArray *array = [urlStr componentsSeparatedByString:@"access_token="];
if(array.count > 1)
{
    NSString *oauth_token = [[[array objectAtIndex:1] componentsSeparatedByString:@"&"] objectAtIndex:0];
    //do something with the oauth token after this.
}

这篇关于谷歌加API用于在Facebook上张贴在墙上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆