title: NSMutableArray not retaining object after for loop
body: <p>I'm trying to add to a <code>NSMutableArray</code> some <code>UIImages</code> downloaded with <a href="https://github.com/rs/SDWebImage" rel="nofollow"><code>SDWebImage</code></a> in order to display them later.</p>
  
  <p>The problem I'm having is that initially the array stores the objects in the completion loop, but then it loses them.</p>
  
  <p>The array is initialized in <code>viewDidLoad</code>, and it has a property declared in <code>.h</code> file.</p>
  
  <pre><code>SDWebImageManager *manager = [SDWebImageManager sharedManager];
  
      for (int i = 0; i&lt;urlsArray.count; i++ )
      {
          [manager downloadImageWithURL:[urlsArray objectAtIndex:i] options:SDWebImageDelayPlaceholder progress:nil 
              completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) 
              {
                  [self.photosArray addObject:image];
                  //Here are stored into self.photosArray
              }];
      }
     //Here the photosArray is empty
  </code></pre>
  
  <p>But after re-entering the view, the objects are there. Really weird. It doesn't display them at the first try.</p>
  
  <p>I've already searched here and on Google, but nothing really helped me.</p>