title: Save multiple images quickly in iOS 6 (custom album)
body: <p>I'm writing an application that will take several images from URL's, turn them into a UIImage and then add them to the photo library and then to the custom album. I don't believe its possible to add them to a custom album without having them in the Camera Roll, so I'm accepting it as impossible (but it would be ideal if this is possible).</p>
  
  <p>My problem is that I'm using the code from <a href="http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/" rel="nofollow">this site</a> and it does work, but once it's dealing with larger photos it returns a few as 'Write Busy'. I have successfully got them all to save if I copy the function inside its own completion code and then again inside the next one and so on until 6 (the most I saw it take was 3-4 but I don't know the size of the images and I could get some really big ones) - this has lead to the problem that they weren't all included in the custom album as they error'd at this stage too and there was no block in place to get it to repeat.</p>
  
  <p>I understand that the actual image saving is moved to a background thread (although I don't specifically set this) as my code returns as all done before errors start appearing, but ideally I need to queue up images to be saved on a single background thread so they happen synchronously but do not freeze the UI.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:singleImage]]];
      [self.library saveImage:image toAlbum:@"Test Album" withCompletionBlock:^(NSError *error) {
          if (error!=nil) {
              NSLog(@"Error");
          }
      }];
  </code></pre>
  
  <p>I've removed the repetition of the code otherwise the code sample would be very long! It was previously where the NSLog code existed.</p>
  
  <p>For my test sample I am dealing with 25 images, but this could easily be 200 or so, and could be very high resolution, so I need something that's able to reliably do this over and over again without missing several images.</p>
  
  <p>thanks
  Rob</p>