第一部分:App的信息
获取App的版本号、App的build版本号、包名、App显示名称等等
/*获取当前App的版本号信息*/
+ (NSString *)getAppVersion
{
NSBundle *currentBundle = [NSBundle mainBundle];
NSDictionary *infoDictionary = [currentBundle infoDictionary];
return [infoDictionary objectForKey:@"CFBundleShortVersionString"];
}
/*获取当前App的build版本号信息*/
+ (NSString *)getAppBuildVersion
{
NSBundle *currentBundle = [NSBundle mainBundle];
NSDictionary *infoDictionary = [currentBundle infoDictionary];
return [infoDictionary objectForKey:@"CFBundleVersion"];
}
/*获取当前App的包名信息*/
+ (NSString *)getAppBundleId
{
NSBundle *currentBundle = [NSBundle mainBundle];
NSDictionary *infoDictionary = [currentBundle infoDictionary];
return [infoDictionary objectForKey:@"CFBundleIdentifier"];
}
/*获取当前App的名称信息*/
+ (NSString *)getAppDisplayName
{
NSBundle *currentBundle = [NSBundle mainBundle];
NSDictionary *infoDictionary = [currentBundle infoDictionary];
return [infoDictionary objectForKey:@"CFBundleDisplayName"];
}
第二部分,设备信息
手机系统版本、手机版本
/*手机系统版本*/
+(NSString *)phoneVersion{
return [[UIDevice currentDevice] systemVersion];
}
/*手机(设备)版本*/
+ (NSString*)deviceVersion
{
// 需要#import "sys/utsname.h"
struct utsname systemInfo;
uname(&systemInfo);
NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8Str