iOS 中显示的 Google API 消息

问题描述 投票:0回答:1

我尝试通过 Google API 获取用户信息,但是 我收到以下错误:

error: {
    errors: [
    {
    domain: "usageLimits",
    reason: "accessNotConfigured",
    message: "Access Not Configured. Please use Google Developers Console to activate the API for your project."
    }
    ],
    code: 403,
    message: "Access Not Configured. Please use Google Developers Console to activate the API for your project."
    }
}

我的代码如下:

-(void)get_real_profile:(NSString*)userid
{
    // POST parameters
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.googleapis.com/plus/v1/people/%@?key=xxxxxxxxxxxxxxxxx",userid]];
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url];
    [urlRequest setHTTPMethod:@"GET"];
    [urlRequest setValue:userid forHTTPHeaderField:@"userId"];
    [NSURLConnection sendAsynchronousRequest:urlRequest
                                       queue:[NSOperationQueue mainQueue]
                           completionHandler:^(NSURLResponse *response,
                                               NSData *data,
                                               NSError *connectionError) {

                               NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
                               NSLog(@"%@",json);
                           }];
}

我没有启用此应用程序的计费。那么,计费被禁用有什么问题吗?

帮我解决这个问题。

ios objective-c google-api
1个回答
0
投票
  1. 登录 https://code.google.com/apis/consoleu200e
  2. 点击
    APIs and Auth
  3. 启用您要访问的相关API
  4. 确保为您从代码访问的项目启用它。活动项目显示在
    overview
    链接上方
© www.soinside.com 2019 - 2024. All rights reserved.