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.
In the info.plist of your project just enter an asterisks ('*') as an item of CFBundleTypeExtension as shown in the picture below.
精彩评论