0

我正在开发一个使用 Google 自定义搜索 api 作为功能的应用程序。我添加了一个新的自定义搜索并包含一些要搜索的网站,我能够进行搜索并获得我需要的结果,但突然间它停止返回结果。它改为返回一个空数组。我没有更改任何内容,但看起来我的查询数量有限,对吗?

这是负责查询搜索词的代码行:

NSString *search = [NSString stringWithFormat:@"https://www.googleapis.com/customsearch/v1?start=1&ie=utf8&key=XXXXXX&cx=XXXXX&q=SEARHWORD&alt=json"];  
url = [NSURL URLWithString:[search stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url];
NSURLConnection *searchConnection = [[NSURLConnection alloc]initWithRequest:request delegate:self];

然后是解析结果的正常步骤。

4

1 回答 1

0

如果它工作正常,然后突然停止,你可能已经达到了极限。

您可以通过复制粘贴仔细检查

https://www.googleapis.com/customsearch/v1?start=1&ie=utf8&key=XXXXXX&cx=XXXXX&q=SEARHWORD&alt=json

在浏览器中查看响应

于 2012-01-08T11:40:02.280 回答