//首先获得Info.plist文件路径
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Info.plist" ofType:nil];
//其次通过这个文件路径获得字典文件(因为Info.plist内容本身就是个字典集)
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:filePath];
NSLog(@"%@", dict);
NSString *version = dict[@"CFBundleShortVersionString"];
NSLog(@"通过第一种方式获取版本号%@", version);
//第二种方式获取版本号
NSString *version2 = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
NSLog(@"通过第二种方式获取版本号%@", version2);
IOS获取plist文件信息
最新推荐文章于 2020-03-24 14:55:59 发布
