Get supported document types

217 Views Asked by At

How do you get the list of all supported document types in a Cocoa app, programatically?

I expected to find this in NSDocumentController but the closest thing appears to be documentClassNames, a list of NSDocument subclasses.

1

There are 1 best solutions below

6
On BEST ANSWER

EDIT 1:

If you open Project.-Info.plist then there you can find Document types.

And this is written is a plist (key-value pairs) you can simply get those values.

NSDictionary *infoDict=[[NSBundle mainBundle] infoDictionary];
NSArray *extensions=[infoDict valueForKeyPath:@"CFBundleDocumentTypes.CFBundleTypeExtensions"];
NSLog(@"ext:%@",extensions);

enter image description here