views:

23

answers:

0

Hi,

I would like to get all the extensions of files my app can open. And I'd like to get them from my Info.plist. Right now I have this, but is there a better alternative?

NSMutableArray *types = [NSMutableArray new];
NSArray *documentTypes = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleDocumentTypes"];
for (NSDictionary *dict in documentTypes) {
    for (NSString *extension in [dict objectForKey: @"CFBundleTypeExtensions"])
        [types addObject: extension];
}
return [types autorelease];

Thanks in advance.