In iOS8 and later, i get images at this code:
PHFetchOptions *option = [[PHFetchOptions alloc] init];
option.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];
PHFetchResult *result = [PHAsset fetchAssetsInAssetCollection:_collection options:option];
[result enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (((PHAsset *)obj).mediaType == PHAssetMediaTypeImage) {
PHCachingImageManager *imageManager = [[PHCachingImageManager alloc] init];
PHAsset *asset = obj;
PHImageRequestOptions * options = [[PHImageRequestOptions alloc] init];
options.networkAccessAllowed = YES;
options.synchronous = YES;
[imageManager requestImageDataForAsset:asset options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
/*******/
/* Now I get image type in here with imageDate*/
/* I just want JPG type Image*/
}];
}
}];
But in this code, I need a lot of time, So how can I get Image Type with PHAsset and don't use requestImageData
据我所知,您无法通过PHAsset获取图像类型,但是可以通过CIImage的属性properties(properties是属性的名称)来获取
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.