title: Save UIImage to Photo Album with writeImageToSavedPhotosAlbum
body: <p>I'm trying to save a UIImage to Photo Album. I've tried severl methods the last one is:</p>
  
  <pre><code>-(IBAction)captureLocalImage:(id)sender{
  
  [photoCaptureButton setEnabled:NO];
  
  // Save to assets library
  ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  
  [library writeImageToSavedPhotosAlbum: imageView.image.CGImage metadata:nil completionBlock:^(NSURL *assetURL, NSError *error2)
   {
       //             report_memory(@"After writing to library");
       if (error2) {
           NSLog(@"ERROR: the image failed to be written");
       }
       else {
           NSLog(@"PHOTO SAVED - assetURL: %@", assetURL);
       }
  
       runOnMainQueueWithoutDeadlocking(^{
           //                 report_memory(@"Operation completed");
           [photoCaptureButton setEnabled:YES];
       });
   }];  
  
  }
  </code></pre>
  
  <p>imageView is a UIImageView which contain the image I want to save.
  On log I got "PHOTO SAVED - assetURL: (null)" and the photo doesn't save to library.</p>
  
  <p>What am I doing wrong?</p>