Get MIME type ALAsset

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

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

But it does not contain data of type MIME ...

+4
source share
1 answer
ALAssetRepresentation *rep = [asset defaultRepresentation];

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

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

+15
source

Source: https://habr.com/ru/post/1531323/


All Articles