Info.plist
常见属性:(括号里是用文本编辑器打开时看到的key)
- Bundle name:软件名称
- Bundle identifier(CFBundleIdentifier):应用程序的唯一标识符
- Bundle versions string, short:应用程序真实版本号
- Bundle version:编译版本号
- Localiztion native development region(CFBundleDevelopmentRegion):本地化相关
- Bundle display name(CFBundleDisplayName):程序安装后显示的名称,限制在10-12个字符,如果超出,将被显示缩写名称
- Icon file(CFBundleIconFile):app图标名称,一般为Icon.png
第一种方式加载Info.plist文件:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Info.plist" ofType:nil];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:filePath];
第二种方式加载Info.plist文件:
NSDictionary *dict = [NSBundle mainBundle].infoDictionary;
获取当前的版本号:
NSString *verision = dict[@"CFBundleShortVersionString"];