Instance Method


Prepares image representations of the specified assets for later use.


- (void)startCachingImagesForAssets:(NSArray<PHAsset *> *)assets targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(PHImageRequestOptions *)options;



An array of PHAsset objects for which to prepare image representations.


The size of the images to be prepared.


An option for how to fit the images to the aspect ratio of the requested size. For details, see PHImageContentMode.


Options specifying how Photos should handle the request, format the requested images, and notify your app of progress or errors. For details, see PHImageRequestOptions.


When you call this method, Photos begins to fetch image data and generates thumbnail images on a background thread. At any time afterward, you can use the requestImageForAsset:targetSize:contentMode:options:resultHandler: method to request individual images from the cache. If Photos has finished preparing a requested image, that method provides the image immediately.

Photos caches images with the exact target size, content mode, and options you specify in this method. If you later request an image with, for example, a different target size than you passed when calling this method, Photos cannot make use of the cache and so it must fetch or generate a new image.

See Also

Preparing Images

- stopCachingImagesForAssets:targetSize:contentMode:options:

Cancels image preparation for the specified assets and options.

- stopCachingImagesForAllAssets

Cancels all image preparation that is currently in progress.