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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -