使用AFN解析服务器返回的错误

+(id)codeWithError:(NSError *)error{

NSData * data = [error.userInfo objectForKey:AFNetworkingOperationFailingURLResponseDataErrorKey];
id json = nil;
if (data && (json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil])) {

// NSUInteger code = [[json objectForKey:@"code"] integerValue];
return json;
}
return json;
}

你可能感兴趣的:(使用AFN解析服务器返回的错误)