我是 AFNetworking 的新手,我很难从服务器中检索图像数据。我想显示存储在 Web 服务器 API 中的图像。这是我的 URLRequest 回来的:
{
o_id: "2",
g_id: "1",
title: "Here's a new objective",
description: "This is the description",
hint: "",
target: "10",
timestamp: "2012-09-19 17:24:59",
filename: "http://uploadedimageurl.co.uk/view/uploads/obj_2_1351788537.jpg",
image_width: "600",
active: "1",
group_name: "Test Group",
n_insights: "15",
n_comments: "0",
unixtimestamp: 1348071899,
}
我想检索文件名中的图像:我只是对我将如何做这件事画个空白。我已经尝试过使用AFImageRequestOperation但我不确定我是否走在正确的轨道上 - 我将展示我到目前为止所拥有的......
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/api/groups/get/1",URL_ROOT]];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
NSURLRequest *request = [httpClient requestWithMethod:@"GET" path:nil parameters:nil];
AFImageRequestOperation *imageOperation = [AFImageRequestOperation imageRequestOperationWithRequest:request imageProcessingBlock:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image)
{
} failure:nil];
[imageOperation start];
只是想看看我是否朝着检索此图像数据的正确方向前进,但也想知道如何检索存储在文件名中的图像:有什么想法吗?在此先感谢伙计们!