Further to the discussion in the comments you probably want to do something like this...
Do something inline in the block for fetchCommentsForNode:success:
- update the dictionary:
NSMutableDictionary *properties = [@{@"imageView": imageview,
@"title": [fileInfo objectForKey:@"title"]} mutableCopy];
[self fetchCommentsForNode:[fileInfo objectForKey:@"nid"] success:^(id responseObject){
properties[@"comments"] = responseObject;
return responseObject;
}];
VDPhoto *photo = [VDPhoto photoWithProperties:properties];
[photos addObject:photo];
All you have to do is make sure the @property
in the VDPhoto
you save the properties
to in the init
method is strong
, and not copy
and then you can look at the dictionary and you will have your comments set once the success
block has been called.
EDIT:
An even better option would be to add a @property (nonatomic, copy) NSArray *comments
property to VDPhoto
, and then set the result on the fetchCommentsForNode:
on that:
VDPhoto *photo = [VDPhoto photoWithProperties:@{@"imageView": imageview,
@"title": [fileInfo objectForKey:@"title"]}];
[photos addObject:photo];
[self fetchCommentsForNode:[fileInfo objectForKey:@"nid"] success:^(id responseObject){
photo.comments = responseObject;
return responseObject;
}];