有没有办法获取ALAsset的MIME类型?有一个很好的元数据方法:
NSDictionary *data = [[asset defaultRepresentation] metadata];
但这并不包含MIME类型数据......
答案 0 :(得分:15)
ALAssetRepresentation *rep = [asset defaultRepresentation];
NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass
((__bridge CFStringRef)[rep UTI], kUTTagClassMIMEType);
这将为您提供MIME类型。您需要添加MobileCoreService框架并导入<MobileCoreServices/MobileCoreServices.h>