本文介绍了获取ALAsset的MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以获取ALAsset的MIME类型?有一种很好的元数据方法:

Is there a way how to get MIME type for ALAsset? There is a nice method for metadata:

NSDictionary *data = [[asset defaultRepresentation] metadata];

但是其中不包含MIME类型数据...

But that doesn't contain MIME type data...

推荐答案

ALAssetRepresentation *rep = [asset defaultRepresentation];

NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass
             ((__bridge CFStringRef)[rep UTI], kUTTagClassMIMEType);

这将为您提供MIME类型.您需要添加MobileCoreService框架并导入<MobileCoreServices/MobileCoreServices.h>

This will give you the MIME type. You need to add MobileCoreService framework and import <MobileCoreServices/MobileCoreServices.h>

这篇关于获取ALAsset的MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 08:22
查看更多