We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CTApiProxy中 NSDictionary *result = [request.service resultWithResponseObject:responseObject response:response request:request error:&error]; 如果上面返回的error是nil,对error取地址的话是有值的 接下来Demoservice中,提前返回了,造成请求成功时kCTApiProxyValidateResultKeyResponseObject里面的值为空,后面的请求结果拿不到值
NSDictionary *result = [request.service resultWithResponseObject:responseObject response:response request:request error:&error];
`- (NSDictionary *)resultWithResponseObject:(id)responseObject response:(NSURLResponse *)response request:(NSURLRequest *)request error:(NSError **)error { NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; if (error || !responseObject) { return result; }
if ([responseObject isKindOfClass:[NSData class]]) { result[kCTApiProxyValidateResultKeyResponseString] = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; result[kCTApiProxyValidateResultKeyResponseObject] = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:NULL]; } else { //这里的kCTApiProxyValidateResultKeyResponseString是用作打印日志用的,实际使用时可以把实际类型的对象转换成string用于日志打印
// result[kCTApiProxyValidateResultKeyResponseString] = responseObject; result[kCTApiProxyValidateResultKeyResponseObject] = responseObject; }
return result;
}`
既然error是用于判断的,就不要写成 error:(NSError **)error这种形式,建议修改如下
NSDictionary *result = [request.service resultWithResponseObject:responseObject response:response request:request error:error]; - (NSDictionary *)resultWithResponseObject:(id)responseObject response:(NSURLResponse *)response request:(NSURLRequest *)request error:(NSError *)error
NSDictionary *result = [request.service resultWithResponseObject:responseObject response:response request:request error:error];
- (NSDictionary *)resultWithResponseObject:(id)responseObject response:(NSURLResponse *)response request:(NSURLRequest *)request error:(NSError *)error
The text was updated successfully, but these errors were encountered:
这个地方的逻辑有问题,要么直接传入error,然后用error做判断 如果要传入&error,那么做判断的时候用*error来做判断
Sorry, something went wrong.
No branches or pull requests
CTApiProxy中
NSDictionary *result = [request.service resultWithResponseObject:responseObject response:response request:request error:&error];
如果上面返回的error是nil,对error取地址的话是有值的
接下来Demoservice中,提前返回了,造成请求成功时kCTApiProxyValidateResultKeyResponseObject里面的值为空,后面的请求结果拿不到值
`- (NSDictionary *)resultWithResponseObject:(id)responseObject response:(NSURLResponse *)response request:(NSURLRequest *)request error:(NSError **)error
{
NSMutableDictionary *result = [[NSMutableDictionary alloc] init];
if (error || !responseObject) {
return result;
}
// result[kCTApiProxyValidateResultKeyResponseString] = responseObject;
result[kCTApiProxyValidateResultKeyResponseObject] = responseObject;
}
}`
既然error是用于判断的,就不要写成 error:(NSError **)error这种形式,建议修改如下
NSDictionary *result = [request.service resultWithResponseObject:responseObject response:response request:request error:error];
- (NSDictionary *)resultWithResponseObject:(id)responseObject response:(NSURLResponse *)response request:(NSURLRequest *)request error:(NSError *)error
The text was updated successfully, but these errors were encountered: