AFNetworking 2.0中AFImageRequestOperation的头文件是什么

时间:2014-01-21 16:51:32

标签: ios objective-c afnetworking

我正在尝试运行此代码:

#import "AFNetworking.h"
#import "AFHTTPRequestOperation.h"

AFImageRequestOperation *operation = [[AFImageRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject){
     NSLog(@"%@", operation.responseData); // Data
     NSLog(@"%@", [responseObject class]); // UIImage
 } failure:^(AFHTTPRequestOperation *operation, NSError *error) {}];

但是有这些错误:

  

未知类型名称AFImageRequestOperation;你的意思是AFHTTPRequestOperation?   未知接收者AFImageRequestOperation;你的意思是AFHTTPRequestOperation吗?

1 个答案:

答案 0 :(得分:2)

this github issue中所述:

  

现在,您将使用常规AFHTTPRequestOperation并设置它   responseSerializer到AFImageResponseSerializer对象(可能是   [AFImageResponseSerializer序列化程序])。

     

您可以阅读Migration Guide了解整体信息   序列化的想法。