【问题标题】:iOS: Not able to get all Google People api collection listiOS:无法获取所有 Google People api 集合列表
【发布时间】:2016-10-04 11:35:04
【问题描述】:

以下是我使用GIDSignIn登录从谷歌帐户获取人员/联系人的代码。

代码:

- (void)setAuthorizerForSignIn:(GIDSignIn *)signIns user:(GIDGoogleUser *)user {
    GTMOAuth2Authentication *auth = [[GTMOAuth2Authentication alloc] init];
    [auth setClientID:signIns.clientID];
    [auth setUserEmail:user.profile.email];
    [auth setUserID:user.userID];
    [auth setAccessToken:user.authentication.accessToken];
    [auth setRefreshToken:user.authentication.refreshToken];
    [auth setExpirationDate: user.authentication.accessTokenExpirationDate];
    appDelegate.authGooglePlus = auth;
    NSString *urlStr = @"https://people.googleapis.com/v1/people/me/connections?pageSize=200";
   NSURL *url = [NSURL URLWithString:urlStr];
   NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
   [request setHTTPMethod:@"GET"];
   auth.scope= @"https://www.googleapis.com/auth/contacts";
   [auth authorizeRequest:request
          completionHandler:^(NSError *error) {
              NSString *output = nil;
              if (error) {
                  output = [error description];
              } else {
                  NSURLResponse *response = nil;
                  NSData *data = [NSURLConnection sendSynchronousRequest:request
                                                       returningResponse:&response
                                                                   error:&error];
                  if (data) {
                      output = [[NSString alloc] initWithData:data  encoding:NSUTF8StringEncoding];
                      NSMutableArray *array = [[output JSONValue] objectForKey:@"connections"];
                      }
                  } else {
                      // fetch failed
                      output = [error description];
                  }
              }
          }];
}

以下是我获取人员/联系人列表的代码,但我只能获取 7 条记录而不是所有记录,知道如何实现吗?

【问题讨论】:

    标签: ios objective-c google-api google-people-api


    【解决方案1】:

    Google People API 仅返回联系人组中的联系人。问题很可能是其他记录是“其他联系人”,它们不在任何联系人组中,因此不会被返回。

    目前无法从 Google People API 获取其他联系人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多