我有某个用户的 google iD,我想在我的应用中显示他的 google 个人资料照片。在我的swift
代码中,我尝试获取包含必要信息的 json(基于此答案https://stackoverflow.com/a/22526130/3766930)。这是我的代码:
Alamofire.request(.GET, "https://www.googleapis.com/plus/v1/people/10263...4252?key=AI...Oo")
.responseJSON { response in
print(response)
switch response.result {
case .Success:
dispatch_async(dispatch_get_main_queue(),{
if let jsonData = response.result.value as? [[String: AnyObject]] {
print(jsonData)
}
})
case .Failure(let error):
print("SWITCH ERROR")
print(error)
}
}
但作为回应,我收到了这个错误:
error = {
code = 403;
errors = (
{
domain = usageLimits;
extendedHelp = "https://console.developers.google.com";
message = "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.";
reason = ipRefererBlocked;
}
);
message = "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.";
};
我仔细浏览了我的谷歌开发者控制台,我没有设置任何 IP 限制。这是到目前为止的样子:
我在这里使用 api 密钥:
如您所见,这里没有域限制:
这个奇怪的错误可能是什么原因?