-(NSString*)getAPPInfo
{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
// NSLog(@"app_Name:%@",[infoDictionary objectForKey:@"CFBundleDisplayName"]);
// NSLog(@"app_Version:%@",[infoDictionary objectForKey:@"CFBundleShortVersionString"]);
// NSLog(@"app_build:%@",[infoDictionary objectForKey:@"CFBundleVersion"]);
NSString *appString = [NSStringstringWithFormat:@"\napp_Name:%@\napp_Version:%@\napp_build:%@",[infoDictionary objectForKey:@"CFBundleDisplayName"],[infoDictionary objectForKey:@"CFBundleShortVersionString"],[infoDictionary objectForKey:@"CFBundleVersion"]];
return appString;
}
-(NSString*)getDeviceInfo
{
//设备
// NSLog(@"name: %@", [[UIDevice currentDevice] name]);
// NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]);
// NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]);
// NSLog(@"model: %@", [[UIDevice currentDevice] model]);
// NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);
NSString *deviceString = [NSStringstringWithFormat:@"\nname: %@\nsystemName: %@\nsystemVersion: %@\nmodel: %@\nlocalizedModel: %@",[[UIDevicecurrentDevice] name],[[UIDevicecurrentDevice] systemName],[[UIDevicecurrentDevice] systemVersion],[[UIDevicecurrentDevice] model],[[UIDevicecurrentDevice] localizedModel]];
return deviceString;
}
//可通过苹果review
- (NSString*)getDeviceModel
{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = (char*)malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSStringstringWithCString:machine encoding:NSUTF8StringEncoding];
//NSString *platform = [NSStringstringWithUTF8String:machine];二者等效
free(machine);
return platform;
}
- (NSString *) platformString
{
NSString *platform = [self getDeviceModel];
if ([platform isEqualToString:@"iPhone4,1"]) return@"iPhone4 WiFi";
if ([platform isEqualToString:@"iPhone4,2"]) return @"iPhone4 GSM";
if ([platform isEqualToString:@"iPhone4,3"]) return@"iPhone4 CDMA";
if ([platform isEqualToString:@"iPhone4S,1"]) return@"iPhone4S WiFi";
if ([platform isEqualToString:@"iPhone4S,2"]) return@"iPhone4S GSM";
if ([platform isEqualToString:@"iPhone4S,3"]) return@"iPhone4S CDMA";
if ([platform isEqualToString:@"iPhone5,1"]) return@"iPhone5 WiFi";
if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone5 GSM";
if ([platform isEqualToString:@"iPhone5,3"]) return@"iPhone5 CDMA";
if ([platform isEqualToString:@"iPhone5S,1"]) return@"iPhone5S WiFi";
if ([platform isEqualToString:@"iPhone5S,2"]) return@"iPhone5S GSM";
if ([platform isEqualToString:@"iPhone5S,3"]) return@"iPhone5S CDMA";
return platform;
}