使用AFNetworking 2.0下载PDF文件

使用AFNetworking 2.0下载PDF文件,pdf,afnetworking,afnetworking-2,Pdf,Afnetworking,Afnetworking 2,我想更新到AFNetworking的最新版本。我想知道如何从服务器下载PDF文件,并在我的应用程序中显示它 在旧版本中,我使用了以下代码: AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; operation.responseSerializer = [AFHTTPResponseSerializer serializer]; [op

我想更新到AFNetworking的最新版本。我想知道如何从服务器下载PDF文件,并在我的应用程序中显示它

在旧版本中,我使用了以下代码:

    AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
    operation.responseSerializer = [AFHTTPResponseSerializer serializer]; 
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {

        [webView loadData:responseObject MIMEType:@"application/pdf" textEncodingName:nil baseURL:nil];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//error handling
}

[operation start];
在AFNetworking 2.0中,完成相同工作的代码是什么样子的?我必须使用另一类AFNetworking吗?

只需添加

operation.responseSerializer = [AFHTTPResponseSerializer serializer];
到目前为止,它正在发挥作用。谢谢