iOS Google+ 获取好友数量
iOS Google+ get number of friends
在我的 iOS 应用程序中,我需要检索使用 Google+ SDK 登录的用户的关注者总数,我使用过这种方法,但它 returns与我的帐户相关的总人数。我想只计算关注我并且可以看到我在我的墙上发布的内容的人。
这是我使用的代码:
GTLQueryPlus *query =
[GTLQueryPlus queryForPeopleListWithUserId:@"me"
collection:kGTLPlusCollectionVisible];
// 2. Execute the query.
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLPlusPeopleFeed *peopleFeed,
NSError *error) {
if (error) {
GTMLoggerError(@"Error: %@", error);
} else {
// Render the status of the Google+ request.
NSNumber *count = peopleFeed.totalItems;
Total=[count intValue];
id<GPPShareBuilder> shareBuilder = [self shareBuilder];
if (![shareBuilder open]) {
}
}
}];
我该怎么办?
要获得 Google+ 个人资料的关注者总数,您只需使用 people.get API method and use the circledByCount。请注意,该数字仅在配置文件达到 public 时可用,并且它基于所有关注者,不能仅限于使用当前应用程序的配置文件。
在我的 iOS 应用程序中,我需要检索使用 Google+ SDK 登录的用户的关注者总数,我使用过这种方法,但它 returns与我的帐户相关的总人数。我想只计算关注我并且可以看到我在我的墙上发布的内容的人。 这是我使用的代码:
GTLQueryPlus *query =
[GTLQueryPlus queryForPeopleListWithUserId:@"me"
collection:kGTLPlusCollectionVisible];
// 2. Execute the query.
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLPlusPeopleFeed *peopleFeed,
NSError *error) {
if (error) {
GTMLoggerError(@"Error: %@", error);
} else {
// Render the status of the Google+ request.
NSNumber *count = peopleFeed.totalItems;
Total=[count intValue];
id<GPPShareBuilder> shareBuilder = [self shareBuilder];
if (![shareBuilder open]) {
}
}
}];
我该怎么办?
要获得 Google+ 个人资料的关注者总数,您只需使用 people.get API method and use the circledByCount。请注意,该数字仅在配置文件达到 public 时可用,并且它基于所有关注者,不能仅限于使用当前应用程序的配置文件。