How to get a UTI file when the file has no extension?

Is there a way to define a UTI file (uniform type identifier) ​​even if there is no file extension?

Now I get it like this when the file has the extension:

CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)[file pathExtension], NULL);

I found this snippet on the net whose goal is to do it on a Mac. But I'm on iOS:

CFStringRef typeString = UTCreateStringForOSType(outInfo.filetype);
itemUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, typeString, NULL);
CFRelease( typeString );

Note: outInfo is of type LSItemInfoRecord, which does not exist on iOS.

+5
source share
1 answer

The only way to identify a file that has no extension and other metadata is to look at its contents and determine the file based on this.

, , JPEG, PNG .. , .

, . , , , . , , , , .

, , .

+1

All Articles