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
换张图片
尺寸不对吧 看是不是对输入有要求?