有没有办法从AFHTTPClient中获取失败块中的http状态代码?(is there an easy way to get the http status code in the failure

系统教程 行业动态 更新时间:2024-06-14 17:01:34
有没有办法从AFHTTPClient中获取失败块中的http状态代码?(is there an easy way to get the http status code in the failure block from AFHTTPClient?)

我看到有可以修改的接受的http状态代码列表,但是我认为如果我可以在故障块中获取http状态代码,那将会更加清晰。

好的,找到与操作对象的答案

failure:^(AFHTTPRequestOperation *operation, NSError *error){ NSLog(@"error code %d",[operation.response statusCode]); }];

I see that there is a list of accepted http status codes that I can modify, but I think it would be cleaner if I can get the http status code in the failure block ..

Ok, found the answer with the operation object

failure:^(AFHTTPRequestOperation *operation, NSError *error){ NSLog(@"error code %d",[operation.response statusCode]); }];

最满意答案

好的,找到与操作对象的答案

failure:^(AFHTTPRequestOperation *operation, NSError *error){ NSLog(@"error code %d",[operation.response statusCode]); }];

Ok, found the answer with the operation object

failure:^(AFHTTPRequestOperation *operation, NSError *error){ NSLog(@"error code %d",[operation.response statusCode]); }];

更多推荐

本文发布于:2023-04-20 18:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/e62fcbad2198e7450951cf4624b3b63e.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   状态   代码   http   AFHTTPClient

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!