Robin Robin - 1 year ago 100
iOS Question

Google plus API for posting on wall like Facebook

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.

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.

Answer Source

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.

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.

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

in viewdidload method.

NSString *authStr = @"";

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.

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.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download