AFNetworking失败情况下获取网络请求状态码
2017-10-10 本文已影响374人
喵子G
return [mng DELETE:urlString parameters:parameter success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[JKRNetwork networkSuccessWithTask:task success:success responseObject:responseObject];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSURLResponse *response = task.response;
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
if ([[NSString stringWithFormat:@"%zd", httpResponse.statusCode] hasPrefix:@"2"]) {
[JKRNetwork networkSuccessWithTask:task success:success responseObject:nil];
} else {
[JKRNetwork networkFailureWithTask:task failure:failure error:error];
}
}];