objective-c - NSLocalizedDescription=(200-299)中的预期状态码,得到 400
<p><p>当我尝试发送 HTTP 请求以获取 JSON 响应时:</p>
<pre><code>NSURL *url = ;
NSURLRequest *request = ;
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSLog(@"Success");
} failure:^(NSURLRequest* req,NSHTTPURLResponse *req2, NSError *error,id mex) {
NSLog(@"%@", );
}];
;
</code></pre>
<p>我在日志上得到了这个堆栈:</p>
<pre><code>Error Domain=com.alamofire.networking.error Code=-1011 "Expected status code in (200-299), got 400" UserInfo=0x7bb31b0 {NSErrorFailingURLKey=http://data.baltimorecity.gov/api/views/INLINE/rows.json?method=index, NSLocalizedDescription=Expected status code in (200-299), got 400}
</code></pre>
<p>我错过了什么吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>HTTP 状态码 400 表示“错误请求”。您正在尝试访问格式错误的 URL,或者您正在访问的 URL 希望在请求中看到您未提供的内容。</p></p>
<p style="font-size: 20px;">关于objective-c - NSLocalizedDescription=(200-299)中的预期状态码,得到 400,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/9754331/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/9754331/
</a>
</p>
页:
[1]