ios中的Google API错误
问题描述:
我尝试通过Google API获取用户信息。但是 我得到以下错误。ios中的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);
}];
}
我不启用该应用程序计费。那么,关于计费是否有任何问题是禁用的。
帮我解决这个问题。
谢谢
答
- 登录到https://code.google.com/apis/console
- 点击
APIs and Auth
- 启用要访问
- 确保要启用它的相关API您从代码访问的项目。活动项目显示在
overview
链接上方