title: How to convert PHAsset to UIImage in Objective-C
body: <p>I have an array filled with <code>PHAsset</code> objects (<a href="https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAsset_Class/index.html" rel="noreferrer">https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAsset_Class/index.html</a>), and I want to know how I can convert them into a UIImage and then save them in an Array. </p>
  
  <p>The array with the PHAsset objects is called <code>self.assets</code> and here is what I have so far:</p>
  
  <pre><code>PHImageManager *manager = [PHImageManager defaultManager];
  
  CGFloat scale = UIScreen.mainScreen.scale;
  
  NSMutableArray *images = [NSMutableArray arrayWithCapacity:[self.assets count]];
  
  for (int i = 0; i &lt; [self.assets count]; i++) {
  
      CGSize targetSize = CGSizeMake(scale, scale);
  
      [manager requestImageForAsset:[self.assets objectAtIndex:i]
                         targetSize:targetSize
                        contentMode:PHImageContentModeAspectFill
                            options:self.requestOptions
                      resultHandler:^(UIImage *image, NSDictionary *info){
                          [images addObject:image];
                      }];
  }
  </code></pre>
  
  <p>self.requestOptions is a property in the .h</p>
  
  <pre><code>@property (nonatomic, strong) PHImageRequestOptions *requestOptions;
  </code></pre>
  
  <p>and in the viewDidLoad I am doing this:</p>
  
  <pre><code>self.requestOptions = [[PHImageRequestOptions alloc] init];
  self.requestOptions.resizeMode   = PHImageRequestOptionsResizeModeExact;
  self.requestOptions.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
  </code></pre>
  
  <p>But after doing some debugging, I keep seeing that <code>self.assets</code> has the following values:</p>
  
  <pre><code>(
  &lt;PHAsset: 0x1743828a0&gt; 3B6D658D-EC76-43A1-9793-35D889E9CF15/L0/001 mediaType=1/0, assetSource=3, (2448x2448), creationDate=2015-07-27 02:02:46 +0000, location=1, hidden=0, favorite=0 ,
  &lt;PHAsset: 0x174382970&gt; 50F05575-71D2-446B-BD1E-8E3250E375AD/L0/001 mediaType=1/0, assetSource=3, (2448x2448), creationDate=2015-07-27 02:02:47 +0000, location=1, hidden=0, favorite=0 
  )
  </code></pre>
  
  <p>and <code>images</code> is empty. Does anyone know how I can add convert the PHAssets into UIImages and add them to the <code>images</code> array? Any help is appreciated. Thanks!</p>