谷歌自定义搜索:iOS中的403错误
谷歌自定义搜索从我的iPhone 7.1应用程序返回403错误。这是在模拟器中运行时的响应:谷歌自定义搜索:iOS中的403错误,ios,google-api,search-engine,google-custom-search,Ios,Google Api,Search Engine,Google Custom Search,谷歌自定义搜索从我的iPhone 7.1应用程序返回403错误。这是在模拟器中运行时的响应: { "error": { "errors": [ { "domain": "usageLimits", "reason": "accessNotConfigured", "message": "Access Not Configured. Please use Google Developers Console to activate the API for your
{
"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."
}
}
以下步骤中是否存在缺陷?我想建立一个适用于iOS应用程序的CSE设置过程。希望每一步的截图都能有所帮助,而不是混淆
- 在步骤2中,将“q”设置为任何测试查询词(“foo-bar”),将“cx”设置为搜索引擎ID
- 按“执行”并接收您的搜索结果。他们工作。谷歌还提供了这个URL,我们将在第8步的Xcode中重复使用它。
NSData*响应包含上述错误403。谢谢你对问题的任何想法 缺少标题字段X-Ios-Bundle-Identifier
NSString *bundleID = @"com.yourCompany.yourApp";
//...define request as above
[request setHTTPMethod:@"GET"];
[request setValue:bundleID forHTTPHeaderField:@"X-Ios-Bundle-Identifier"];
我面临着同样的错误,你对此有什么解决办法吗?谢谢你的提醒!我用对我有用的答案回答。这个问题确实帮助我弄清楚了整个过程,这就是你想要知道的一切,让它发挥作用:非常感谢!这解决了我的问题。