AFNetworking 2通过POST将JPEG直接下载到文件中

时间:2014-01-24 19:28:17

标签: post download jpeg afnetworking-2

我正在使用AFNetworking 2.0通过POST请求下载jpeg图像:


[manager.httpManager.requestSerializer setValue:@"image/jpeg" forHTTPHeaderField:@"Accept"];
NSDictionary *parameters = @{@"filename": imageName};
manager.httpManager.responseSerializer = [AFImageResponseSerializer serializer];

AFHTTPRequestOperation *operation = [manager.httpManager POST:URL_BASE_IMG parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {

    NSLog(@"Image: %@", responseObject);                

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {

    NSLog(@"Error: %@", error);

}];

显示responseObject不是问题。但是,如何指定路径以便将响应对象直接下载到其中?我已经看过使用流但我不知道如何在这里实现它。任何人?提前致谢

0 个答案:

没有答案