I have an array filled with PHAsset objects (https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAsset_Class/index.html), and I want
Swift 3.0 Answer
let photoAsset = asset
let manager = PHImageManager.default()
var options: PHImageRequestOptions?
options = PHImageRequestOptions()
options?.resizeMode = .exact
options?.isSynchronous = true
manager.requestImage(
for: photoAsset,
targetSize: PHImageManagerMaximumSize,
contentMode: .aspectFill,
options: options
) { [weak self] result, _ in
completion(result)
}
options?.isSynchronous = true is very important
BOOL synchronous; // return only a single result, blocking until available (or failure). Defaults to NO