0

I accidentally mistyped the post path and noticed that although it's being wrong, the success block is called:

[[APIClient sharedInstance]
 postPath:@"api_url"
 parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
     NSLog(@"Result: Success %@",[responseObject description]);

 } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
     //handle error
     NSLog(@"Result: Failure + %@",error.userInfo);

  }];

Of course the data are not being sent to server and the transaction is not processed, but I want to know why it's not the failure block which is supposed to be called in case the path is wrong? Thanx.

4

1 回答 1

1

requestOperation如果完成后有关联的错误,则调用失败。错误的原因包括响应不正确Content-Type、没有可接受的状态代码(默认为 2XX 范围)或处理下载数据时出错。

为什么您的服务器返回具有正确内容类型的 200 响应只是您可以确定的问题。

于 2013-05-22T19:12:49.027 回答