RestKit:请求失败时获取HTTP状态代码 [英] RestKit: Getting HTTP status code when a request fails

查看:153
本文介绍了RestKit:请求失败时获取HTTP状态代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS应用程序中使用RestKit,我需要对某些HTTP错误代码进行特殊处理。如何在请求中检查响应HTTP状态代码:didFailLoadWithError:用户信息 NSError 字典中是否有一些条目?

I'm using RestKit in an iOS app and I need to have special handling for certain HTTP error codes. How can the the response HTTP status code be checked inside of request:didFailLoadWithError:? Is there some entry in the userInfo dictionary of the NSError?

我在 <$ c中找不到任何内容$ c> RKRequestDelegate 文档

以下是委托方法的界面:

Here's the interface for the delegate method:

- (void)request:(RKRequest *)request didFailLoadWithError:(NSError *)error


推荐答案

对于使用新版RESTkit和objectManager的人,可以从 RKObjectRequestOperation

For people using the new version of RESTkit and objectManager, you can fetch the statuscode from the RKObjectRequestOperation:

operation.HTTPRequestOperation.response.statusCode

这篇关于RestKit:请求失败时获取HTTP状态代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆