比较简单,直接上代码了
/// app名字
-(NSString *)getAppName{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
if (app_Name == nil) {
app_Name = @"";
}
return app_Name;
}
/// app版本号
-(NSString *) getAppVersion{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
if (app_Version == nil) {
app_Version = @"";
}
return app_Version;
}
/// app ——Build号
-(NSString *)getAppVersionName{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
if (app_build == nil) {
app_build = @"";
}
return app_build;
}
/// app_bundleID
-(NSString *)getPacakageName{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_build = [infoDictionary objectForKey:@"CFBundleIdentifier"];
if (app_build == nil) {
app_build = @"";
}
return app_build;
}
看下打印信息
app名字:应用信息
app版本号:1.0
app_build号:1
app_bundleID:com.Lfy.appInfo