我正在尝试运行此代码:
#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) {}];
但是有这些错误:
Unknown type name
AFImageRequestOperation
; did you meanAFHTTPRequestOperation
? Unknown receiverAFImageRequestOperation
; did you meanAFHTTPRequestOperation
?
最佳答案
如 this github issue 中所述:
Now, you'd use a regular AFHTTPRequestOperation and set its responseSerializer to an AFImageResponseSerializer object (probably [AFImageResponseSerializer serializer]).
You can read the Migration Guide to know about this whole serialization idea.
关于ios - AFNetworking 2.0中AFImageRequestOperation的头文件是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21264258/