证件照版api为什么一直失败啊,求问
jiangguzheng 发布于2020-07 浏览:1216 回复:2
0
收藏

NSString *photoHttpStr = @"https://aip.baidubce.com/rest/2.0/image-classify/v1/body_seg_photo";

    NSString *totalUrl = [NSString stringWithFormat:@"%@?access_token=%@",photoHttpStr,token];

    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    [manager.requestSerializer willChangeValueForKey:@"timeoutInterval"];

    manager.requestSerializer.timeoutInterval = 20.f;

    [manager.requestSerializer didChangeValueForKey:@"timeoutInterval"];

    AFHTTPRequestSerializer *requestSerializer = [AFJSONRequestSerializer serializer];

    [requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

    manager.requestSerializer = requestSerializer;

    NSString *base64Str = [self base64WithImage:_myImage];

    NSString *imageValue = [self urlEncodeStr:base64Str];

    NSDictionary *param = @{@"image":imageValue};

    [manager POST:totalUrl parameters:param progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {

    

        if (responseObject == nil) {

            return;

        }

        

    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {

 

    }];

一直返回input oversize,图片压缩的话就返回image not exist

收藏
点赞
0
个赞
共2条回复 最后由wangwei8638回复于2020-08
#3wangwei8638回复于2020-08

换张图片

0
#2Randcase回复于2020-07

尺寸不对吧 看是不是对输入有要求?

0
TOP
切换版块