title: Add UIImage to NSMutableArray through Delegate Method S3
body: <p>I'm trying to get AWS S3 to go get images from an S3 bucket, the code below is in two parts. The first (I think) creates the get object request after initiating the array to put the object in (arrayImages, it gets the count from arrayPointer). The second is the delegate method that puts the object (data) in arrayImages once it finishes. I would assume that each time the delegate method is called it would add a new object. Something is wrong here:</p>
  
  <pre><code>-(void)gets3ImageArray
  {
  
      if (arrayImages == nil) {
          arrayImages = [[NSMutableArray alloc] initWithCapacity:[arrayPointer count]];
      }
      else
      {
          [arrayImages removeAllObjects];
      }
  
      AmazonS3Client *s3 = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
  
      for (NSString *name in arrayPointer){
              @try {
          S3GetObjectRequest *gor = [[S3GetObjectRequest alloc]initWithKey:name withBucket:[Constants pictureBucket]];
          [gor setDelegate:self];
          [s3 getObject:gor];
  
      }
  
      @catch (AmazonClientException *exception) {
          [Constants showAlertMessage:exception.message withTitle:@"Download Error"];
      }
      }
  }
  
  -(void)request:(AmazonServiceRequest *)request didReceiveData:(NSData *)data
  {
      UIImage *myImage = [[UIImage alloc] initWithData:data];
      if(!myImage) 
      {
          NSLog(@"NO IMAGE");
          [arrayImages addObject:[UIImage imageNamed:@"placeholder.png"]];
      }
      else
      {
      [arrayImages addObject:[UIImage imageWithData:data]];
  }
  </code></pre>