RestkitwithBlocksを使用して応答を待とうとしています。
例:
NSArray *myArray = ["RESULT OF REST-REQUEST"];
// Working with the array here.
私のブロックリクエストの1つ:
- (UIImage*)getPhotoWithID:(NSString*)photoID style:(NSString*)style authToken:(NSString*)authToken {
__block UIImage *image;
NSDictionary *parameter = [NSDictionary dictionaryWithKeysAndObjects:@"auth_token", authToken, nil];
RKURL *url = [RKURL URLWithBaseURLString:@"urlBase" resourcePath:@"resourcePath" queryParameters:parameter];
NSLog(@"%@", [url absoluteString]);
[[RKClient sharedClient] get:[url absoluteString] usingBlock:^(RKRequest *request) {
request.onDidLoadResponse = ^(RKResponse *response) {
NSLog(@"Response: %@", [response bodyAsString]);
image = [UIImage imageWithData:[response body]];
};
}];
return image;
}