开发者

Get all CFBundleTypeExtensions of an Info.plist

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.

Get all CFBundleTypeExtensions of an Info.plist

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜