I wonder if there any way to get the original file name using PHAsset?
I use the following code to extract the file info.
[[PHImageManager defaultManager] requestImageDataForAsset:asset options:requestOption resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) { entity.fileUrl = [info objectForKey:@"PHImageFileURLKey"]; entity.filename = [[NSFileManager defaultManager] displayNameAtPath:[ entity.fileUrl path]]; }];
However, It doesn't return original name but the name in the format "img_123" I've just checked official apple docs . there has been introduced a new class PHAssetResource
and the property originalFilename
which is available in the iOS 9+. The problem is that I use the image picker library CTAssetsPickerController which 's based on the Photos framework; it returns picked image as the PHAsset
object . PS. I'm looking for the solution which is compatible with iOS 8 :). Thank you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With