1

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.

hpique
  • 119,096
  • 131
  • 338
  • 476

1 Answers1

2

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

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140