ios8 - 如何使用 Photos API 在 iOS 8.0 中检索照片扩展名 (jpg/png)?

标签 ios8 photos photosframework

我尝试使用 iOS 8 中的新照片 API 获取照片的文件扩展名,但到目前为止尚未找到方法。在 iOS 8.0 之前,我会使用 ALAssetRepresentation 来获取文件扩展名,例如:

// Get asset representation from asset
ALAssetRepresentation *assetRepresentation = [asset defaultRepresentation];

// Extract file extension from the original file name
NSString* fileExt = [[assetRepresentation filename] pathExtension];

现在有办法获取照片的文件扩展名吗? PS:我正在使用新的照片 API,因为我需要访问照片应用程序中的所有照片,而 ALassetsLibrary 仅允许访问“最近添加”的照片。

最佳答案

我明白了。

[[PHImageManager defaultManager] requestImageDataForAsset:asset options:imageRequestOptions resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {

        NSLog(@"info - %@", info);
    }];

PHImageFileDataKey = <PLXPCShMemData: 0x179ab6d0> bufferLength=1384448 dataLength=1384448;
PHImageFileOrientationKey = 1;
PHImageFileSandboxExtensionTokenKey = "c05e608acaf0bb212086ed2d512ccc97ea720ac3;00000000;00000000;0000001a;com.apple.app-sandbox.read;00000001;01000003;0000000000030b8c;/private/var/mobile/Media/DCIM/102APPLE/IMG_2607.JPG";
PHImageFileURLKey = "file:///var/mobile/Media/DCIM/102APPLE/IMG_2607.JPG";
PHImageFileUTIKey = "public.jpeg";
PHImageResultDeliveredImageFormatKey = 9999;
PHImageResultIsDegradedKey = 0;
PHImageResultIsInCloudKey = 0;
PHImageResultIsPlaceholderKey = 0;
PHImageResultWantedImageFormatKey = 9999;

关于ios8 - 如何使用 Photos API 在 iOS 8.0 中检索照片扩展名 (jpg/png)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25919512/

相关文章:

iphone - Swift 隐藏后无法显示后退按钮

ios - 这个后台应用通知的名称是什么?

image-processing - 有没有办法以编程方式检测照片是否对焦?

ios - 从 Photos.app 获取最后一张图片?

ios - 如何测试 PHImageResultIsInCloudKey?

iOS 8 核心数据堆栈 - fatal error : found nil while unwrapping an Optional value

ios8 - MPMoviePlayerController 布局约束问题

private - 如何通过Flickrj Api访问私有(private)照片?

ios - 在 iOS 8 中编辑照片 : Allow "YourApp" to modify this photo?

ios 8 照片框架-[performChanges :completionHandler] progression