如何在IOS Sdk中获取Google Plus圈子 [英] How to Fetch Google Plus circles in IOS Sdk
问题描述
我正在使用Google Plus集成,我必须获取用户圈。
I am using Google Plus integration where I have to fetch circles of user.
我正在传递Url: https://www.googleapis.com/plus/v1/people/Your_User_Id/people/visible?key= APP_Key 。
我的回复是:
{ error = { code = 403; errors = ( { domain = global; message = Forbidden; reason = forbidden; } ); message = Forbidden; }; }
此请求需要什么样的权限?
What kind of permission do I need for This request?
推荐答案
您只能为已登录的用户执行此操作 - 因此Your_User_Id应始终为me。也可以传递应用密钥,但您必须使用已登录到您应用的用户使用oAuth 2.0令牌进行呼叫。您可以在此处查看所有详细信息: https://developers.google.com/+ / mobile / ios / people#retrieve_a_collection_of_people
You can only do this for the signed in user - so the "Your_User_Id" should always be "me". It's fine to pass the app key as well, but you must be making the call with an oAuth 2.0 token from a user who has signed in to your app. You can see all the details here: https://developers.google.com/+/mobile/ios/people#retrieve_a_collection_of_people
基本上您需要实施登录,如果您还没有登录,那么您可以使用GPPSignIn sharedInstance中的plusService:
Basically you'd need to implement sign-in, if you haven't already, then you can use the plusService in the GPPSignIn sharedInstance:
GTLQueryPlus *query =
[GTLQueryPlus queryForPeopleListWithUserId:@"me"
collection:kGTLPlusCollectionVisible];
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLPlusPeopleFeed *peopleFeed,
NSError *error) {
if (error) {
GTMLoggerError(@"Error: %@", error);
} else {
// Get an array of people from GTLPlusPeopleFeed
NSArray* peopleList = [peopleFeed.items retain];
}
}];
这是调用您在那里提供的URL。
That is calling the URL that you're giving there.
这篇关于如何在IOS Sdk中获取Google Plus圈子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!