问题
Is there a way how to get MIME type for ALAsset? There is a nice method for metadata:
NSDictionary *data = [[asset defaultRepresentation] metadata];
But that doesn't contain MIME type data...
回答1:
ALAssetRepresentation *rep = [asset defaultRepresentation];
NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass
((__bridge CFStringRef)[rep UTI], kUTTagClassMIMEType);
This will give you the MIME type. You need to add MobileCoreService framework and import <MobileCoreServices/MobileCoreServices.h>
来源:https://stackoverflow.com/questions/22351587/get-mime-type-of-an-alasset