Objective C: For loop is finished before image is finished
<p>I have an <code>arrayOfLinks</code> that contains a lot of url links. I need to get images from these links. I am using the following code to do so.</p>

<pre><code>- (void)getImages {
    NSArray *links = arrayOfLinks;

    for (NSString *link in links ) {
            [self.picImage sd_setImageWithURL:[NSURL URLWithString:link] placeholderImage:nil options:SDWebImageHighPriority completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                NSLog(@"pic image set finished");
            }];
        }
           [self finishSettingImages];
           NSLog(@"for loop finished");
    }
</code></pre>

<p>This almost works, but the problem is the for loop finishes before the images are set. I want to call the method <code>finishSettingImages</code> after each image is set. What would be the best way to do this?</p>

<p>Edit: I want the method 'finishSettingImages' called after ALL the images are set. Sorry for not clarifying this.</p>