ios - AFNetworking 2.0中AFImageRequestOperation的头文件是什么

标签 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) {}];

但是有这些错误:

Unknown type name AFImageRequestOperation; did you mean AFHTTPRequestOperation? Unknown receiver AFImageRequestOperation; did you mean AFHTTPRequestOperation?

最佳答案

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/

相关文章:

ios - AFNetworking 文件下载错误Error Domain=NSCocoaErrorDomain Code=260

ios - CGFloat 在哪个 Apple 硬件/操作系统上是 32 位的,哪个是 64 位的?

iphone - 如何比较自定义 UITableViewCel 中的标签是否为空?

ios - GameCenter 游戏中的玩家数量可以超过 4 人吗?

ios - Objective-C:使用 UNUserNotificationCenter 设置计时器以显示提醒

ios - NSArray mutableCopy 创建新数组但仍指向旧内容

ios - 以编程方式在 ios 中创建容器 View

ios - postObject 的 Restkit 返回值

ios - NSString 到 SecKeyRef

ios - 将 AFNetworking 2.0 与后台任务结合使用