nsurl - Getting the file kind by extension on iOS -
when take .dae
file , file, info
on osx's finder see
kind: digital asset exchange (dae)
.rtfd
shows
kind: rich text document attachments
but osx. now, how discover kind of file on ios nsurl of file?
there may other ways, 1 way use uniform type identifier (uti) services provided mobilecoreservices
.
import mobilecoreservices
just description associated extension's uti:
if let uti = uttypecreatepreferredidentifierfortag(kuttagclassfilenameextension, pathextension, nil)?.takeretainedvalue(), let description = uttypecopydescription(uti)?.takeretainedvalue() { print(description) }
see how system identifies type of content in file in file system programming guide.
Comments
Post a Comment