pragma mark ---获取当前的版本号
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Info.plist" ofType:nil];
//字典中存放的是info.plist的所有内容
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:filePath];
NSString *version = dict[@"CFBundleShortVersionString"];
//第二种方法获取
version = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
NSLog(@"%@",version);
网友评论