0

Jsonfilenamesをに転送するにはどうすればよいNSArrayですか?

受信した JSON:

(
        {
        filename = "3801a77e22c2b552b4fef67b8454b727b291fd23.jpg";
    },
        {
        filename = "c0839e7e8ba1ab53c3ff1faf3e261b84ec702a5f.jpg";
    }
)

.h に宣言:

@property (nonatomic, retain) NSMutableArray *images;

.m へのコード:

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/initialimages", SERVER_APIURL]];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET" path:nil parameters:nil];
[request setTimeoutInterval:15];

AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {

    for (NSDictionary *dict in JSON) {
        [_images addObject:[dict objectForKey:@"filename"]];
        NSLog(@"%@", _images);
    }

} failure:nil];
[operation start];

出力:

2013-04-25 18:44:13.876 SP[6989:907] (null)
2013-04-25 18:44:13.877 SP[6989:907] (null)
4

1 に答える 1