美文网首页iOS开发技术分享
AFNetworking失败情况下获取网络请求状态码

AFNetworking失败情况下获取网络请求状态码

作者: 喵子G | 来源:发表于2017-10-10 13:20 被阅读374次
    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];
        }
    }];
    

    相关文章

      网友评论

        本文标题:AFNetworking失败情况下获取网络请求状态码

        本文链接:https://www.haomeiwen.com/subject/agfvyxtx.html