2014-01-21 56 views
2

我試圖運行此代碼:什麼是AFImageRequestOperation頭文件中AFNetworking 2.0

#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

http://stackoverflow.com/questions/19172543/afnetworking-2-0-setimagewithurlrequest可能的重複 – titaniumdecoy

回答

2

正如this github issue說:

現在,你會使用常規AFHTTPRequestOperation及其 responseSerializer設置爲AFImageResponseSerializer對象(可能 [AFImageResponseSerializer串行])。

您可以閱讀Migration Guide瞭解關於這整個 序列化的想法。