繁体   English   中英

在自定义框架中阅读info.plist

[英]Read info.plist in custom framework

我想阅读我自己创建的info.plist框架中包含的文件。 当我尝试阅读时,rferans已经阅读了他的文件info.plist框架应用程序。

我需要同时阅读。 我该怎么做? 你能帮忙吗?

NSLog(@"*** %@", [[[NSBundle mainBundle] localizedInfoDictionary] valueForKey:@"ASD"]);
NSLog(@"*** %@", [[[NSBundle mainBundle] infoDictionary] valueForKey:@"ASD"]);
NSLog(@"*** %@", [[[[NSBundle allFrameworks] objectAtIndex:0] infoDictionary] valueForKey:@"ASD"]);

框架截图

应用截图

首先使用您的框架路径创建包:

NSString* mainBundlePath = [[NSBundle mainBundle] resourcePath];
NSString* frameworkBundlePath = [mainBundlePath stringByAppendingPathComponent:@"YourFrameworkBundle.bundle"];
frameworkBundle = [NSBundle bundleWithPath:frameworkBundlePath];

然后访问信息字典或您想要的内容

谢谢您的回答。

解决方法如下图:

[[[NSBundle bundleForClass:[self class]] infoDictionary] objectForKey:@"ASD"]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM