How do you get the Finder “Kind” for a file, in 2016?
Asked Answered
E

1

2

This answer says to use LSCopyKindStringForURL(), which has worked great in the past, but it's marked "deprecated" in OS X v10.11.

There's no mention in the API documentation of why it was deprecated. I don't see any mention of Launch Services API changes in the OS X 10.11 release notes at all.

How are you supposed to get the Finder Kind of a file now?

Eisenhart answered 11/6, 2016 at 15:26 Comment(0)
R
9

If you go to the declaration of LSCopyKindStringForURL() in the header (/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSInfoDeprecated.h), you'll find in the comment and the deprecation attribute, the following:

Use the URL resource property kCFURLLocalizedTypeDescriptionKey or NSURLLocalizedTypeDescriptionKey instead.

These are resource keys for use with CFURLCopyResourcePropertyForKey() or -[NSURL getResourceValue:forKey:error:], respectively.

Resignation answered 11/6, 2016 at 15:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.