阅读所有相似的帖子,但找不到解决方案。
NSURLConnection的:
<NSURLConnection: 0x178004020> { request: <NSURLRequest: 0x178003ff0> { URL: https://www.googleapis.com/customsearch/v1?key=[API_KEY_SPECIFIC_TO_IOS_BUNDLE_ID]&cx=[SEARCH_ENGINE_ID_FOR_CUSTOM_SEARCH_ENGINE]&q=[SEARCH_STRING] } }
回复:
{
error = {
code = 403;
errors = (
{
domain = usageLimits;
message = "Access Not Configured. Please use Google Developers Console to activate the API for your project.";
reason = accessNotConfigured;
}
);
message = "Access Not Configured. Please use Google Developers Console to activate the API for your project.";
};
}
我访问了Google Developers Console,并为我的项目探索了自定义搜索API。它对应于此URL:
https://console.developers.google.com/project/[PROJECT ID]/apiui/api/customsearch/method/search.cse.list
它成功运行并显示了此请求(以及正确的结果):
GET https://www.googleapis.com/customsearch/v1?q=[SEARCH_STRING]&cx=[SEARCH_ENGINE_ID_FOR_CUSTOM_SEARCH_ENGINE]&key={YOUR_API_KEY}
X-JavaScript-User-Agent: Google APIs Explorer
所以我从那次成功中得出结论:
我确认自定义搜索API确实已开启
我还在该项目下的API Access页面上验证了我使用的是Simple API Access部分中列出的正确API Key和iOS Apps(包ID)。
我不知道从哪里开始对此进行故障排除并使其正常工作。
非常感谢任何帮助!
答案 0 :(得分:1)
仔细检查您的Google Developers控制台是否显示为以下屏幕(对于您自己的模块,我的是google地图)。
如果您确定开发人员控制台端的所有内容都是正确的,并且仍然看到错误,请从控制台中删除它并重新创建,然后重试。是的,这很奇怪,但在此之前我遇到了类似的问题,我通过删除并重新创建解决了这个问题。