RestKit:请求失败时获取HTTP状态代码

pep*_*psi 17 iphone http ios restkit

我在iOS应用程序中使用RestKit,我需要对某些HTTP错误代码进行特殊处理.如何在内部检查响应HTTP状态代码request:didFailLoadWithError:userInfo字典中是否有一些条目NSError

我在RKRequestDelegate文档中找不到任何内容.

这是委托方法的接口:

- (void)request:(RKRequest *)request didFailLoadWithError:(NSError *)error
Run Code Online (Sandbox Code Playgroud)

Kev*_*n R 52

对于使用新版RESTkit和objectManager的人,您可以从以下位置获取状态码RKObjectRequestOperation:

operation.HTTPRequestOperation.response.statusCode