app信息实际上就是存储在项目的Info.plist文件,获取app信息就是从它中查找,那现在大家都能想到怎么做了吧
//获取info.plist文件
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
//app名称
NSString *name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
//app版本
NSString *version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
//app build版本
NSString *build = [infoDictionary objectForKey:@"CFBundleVersion"];
NSLog(@"name = %@\n version = %@ \n build = %@", name, version, build);