获取 Info.plist 的所有 CFBundleTypeExtensions
我想获取我的应用程序可以打开的所有文件的扩展名。我想从我的 Info.plist 中获取它们。现在我有这个,但是有更好的选择吗?
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];
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在项目的 info.plist 中,只需输入星号(“*”)作为 CFBundleTypeExtension 的一项,如下图所示。
In the info.plist of your project just enter an asterisks ('*') as an item of CFBundleTypeExtension as shown in the picture below.