必应API对我无效

6

我正在使用Bing API,我的问题非常基础。我已经生成了应用程序密钥,但是在控制台输出中出现了错误。

我正在使用此功能获取JSON响应。

NSString *urlString=[NSString stringWithFormat:@"%@%@%@%@",
    @"http://api.search.live.net/json.aspx?Appid=xxxxxxxaxkOatx66TB+CX8qJUIZw=&query=",
    text,@"sources=web&web.offset=",offValue];


NSLog(@"%@",urlString);

NSURL *url=[NSURL URLWithString:urlString];
NSData *data=[NSData dataWithContentsOfURL:url];

当我打印response时,输出如下:

SearchResponse =     {
    Errors =         (
                    {
            Code = 1002;
            HelpUrl = "http://msdn.microsoft.com/en-us/library/dd251042.aspx";
            Message = "Parameter has invalid value.";
            Parameter = "SearchRequest.AppId";
            Value = "zKHS8Fm WcwlhCFh8oYWcs VyUYddig=";
        }
    );
    Query =         {
        SearchTerms = iphone;
    };
    Version = "2.2";
};

这个错误的原因是什么?

谢谢大家。


我认为问题出在我的应用程序密钥上。(我的应用程序密钥中有特殊符号+和=) - QueueOverFlow
1个回答

0

您正在读取的服务器请求参数包含拼写错误。请使用与服务器实现类似的正确名称。只需向服务器代码团队询问请求参数名称,并提供适当的命名约定即可解决此问题。请求应该是键值对,而不是像用逗号分隔所有值的字符串。请提供正确的请求格式。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接