1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
| + (void)collectAppInfo
{
//获取设备信息,如当前系统版本、设备型号,
NSString *content=[[NSString alloc]
initWithFormat:
@"unique id: %@ \nlocalized model: %@ \nsystem version: %@ \nsystem name: %@ \nmodel: %@",
[[UIDevice currentDevice] identifierForVendor],
[[UIDevice currentDevice] localizedModel],
[[UIDevice currentDevice] systemVersion],
[[UIDevice currentDevice] systemName],
[[UIDevice currentDevice] model]];
//platform手机型号
//
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = (char*)malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];
NSLog(@"手机型号 :%@",platform);
//date
NSString *date =[[NSDate date] stringWithFormat:@"yyyy-MM-dd"];
NSString *time =[[NSDate date] stringWithFormat:@"HH:MM:SS"];
NSLog(@"%@\napp version %@\ndate :%@\ntime:%@",content,XcodeAppVersion,date,time);
CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc]init];
CTCarrier*carrier = [netInfo subscriberCellularProvider];
NSLog(@"Carriername:%@\nISO Country Code:%@",[carrier carrierName],[carrier isoCountryCode]);//手机运营商以及运营国家标号
UIScreen *MainScreen = [UIScreen mainScreen];
CGSize Size = [MainScreen bounds].size;
CGFloat scale = [MainScreen scale];
CGFloat screenWidth = Size.width * scale;
CGFloat screenHeight = Size.height * scale;
NSLog(@"屏幕分辨率为 :%.0f %.0f",screenWidth, screenHeight);
NSLog(@"当地所在时区 :%@",[[NSTimeZone localTimeZone] description]);
NSMutableString *cpu = [[NSMutableString alloc] init];
cpu_type_t type;
cpu_subtype_t subtype;
size = sizeof(type);
sysctlbyname("hw.cputype", &type, &size, NULL, 0);
size = sizeof(subtype);
sysctlbyname("hw.cpusubtype", &subtype, &size, NULL, 0);
// values for cputype and cpusubtype defined in mach/machine.h
if (type == CPU_TYPE_X86)
{
[cpu appendString:@"x86 "];
// check for subtype ...
} else if (type == CPU_TYPE_ARM)
{
[cpu appendString:@"ARM"];
switch(subtype)
{
case CPU_SUBTYPE_ARM_V7:
[cpu appendString:@"V7"];
break;
case CPU_SUBTYPE_ARM_V7S:
[cpu appendString:@"V7s"];
break;
// ...
}
}
NSLog(@"cpu 型号 :%@",cpu);
NSArray *arLanguages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
NSString *strLang = [arLanguages objectAtIndex:0];
NSLog(@"LANG:%@",strLang);
NSLog(@"网络环境:%@",[ITTNetworkTrafficManager sharedManager].networkType);
AppInfoModel *appInfo = [[AppInfoModel alloc] init];
appInfo.uniqIdentifier = (NSString*)[[UIDevice currentDevice] identifierForVendor];
appInfo.deviceModel = platform;
appInfo.systemVersion = [[UIDevice currentDevice] systemVersion];
appInfo.systemName = [[UIDevice currentDevice] systemName];
appInfo.systemModel = [[UIDevice currentDevice] model];
appInfo.currentDate = [NSDate date];
appInfo.carrierName = [carrier carrierName];
appInfo.carrierCountryCode = [carrier isoCountryCode];
appInfo.screen = [NSString stringWithFormat:@"%.0fx%.0f",screenWidth, screenHeight];
appInfo.timeZone = [[NSTimeZone localTimeZone] abbreviation];
appInfo.sdkType = @"iOS";
appInfo.packageName = PACKAGE_NAME;
appInfo.appName = XcodeAppName;
NSLog(@"应用名称 :%@\ngmt %@",appInfo.appName ,[[NSTimeZone localTimeZone] abbreviation]);
}
|