现在许多接口都需要上传应用版本信息,所以呢,这个是必不可少的,可以在进入应用的时候先获取到,然后存在单例中,用的时候直接调用单例就好了,记住这些字符串
NSString *executableFile = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey];
//获取项目名称
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];
//获取项目版本号
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
CFShow(infoDictionary);
// app名称
NSString *app_Name = [infoDictionary objectForKey:@
"CFBundleDisplayName"
];
// app版本
NSString *app_Version = [infoDictionary objectForKey:@
"CFBundleShortVersionString"
];
// app build版本
NSString *app_build = [infoDictionary objectForKey:@
"CFBundleVersion"
];