...
|
...
|
@@ -59,10 +59,18 @@ NSString * const JsonKeyDeviceMAC = @"mac"; |
|
|
if (self) {
|
|
|
self.sv = kYHAnalyticsSDKVersion;
|
|
|
self.ch = kDefalutChannelNum; // 默认推广渠道号
|
|
|
self.os = [[UIDevice currentDevice] systemName];
|
|
|
self.osv = [[UIDevice currentDevice] systemVersion];
|
|
|
|
|
|
NSString *os = [[UIDevice currentDevice] systemName];
|
|
|
if (os) {
|
|
|
self.os = os;
|
|
|
self.osv = [[UIDevice currentDevice] systemVersion];
|
|
|
} else {
|
|
|
// 在模拟器上,有时会出现未知系统的情况
|
|
|
self.os = @"Unknown";
|
|
|
self.osv = @"Unknown";
|
|
|
}
|
|
|
|
|
|
self.dm = [[UIDevice currentDevice] model];
|
|
|
// self.udid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
|
|
|
|
|
CGRect rect = [[UIScreen mainScreen] bounds];
|
|
|
CGFloat scale = [[UIScreen mainScreen] scale];
|
...
|
...
|
@@ -70,28 +78,17 @@ NSString * const JsonKeyDeviceMAC = @"mac"; |
|
|
self.res = screenResolution;
|
|
|
self.udid = [OpenUDID value];
|
|
|
|
|
|
//Vendor标示符
|
|
|
self.ifv = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
|
|
//广告标示符
|
|
|
self.ifa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
|
|
|
|
|
|
self.mac = [YHDevice getMacAddress];
|
|
|
}
|
|
|
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
//Vendor标示符
|
|
|
- (NSString *)ifv
|
|
|
{
|
|
|
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
|
|
}
|
|
|
|
|
|
//广告标示符
|
|
|
- (NSString *)ifa
|
|
|
{
|
|
|
return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
|
|
|
}
|
|
|
|
|
|
- (NSString *)mac
|
|
|
{
|
|
|
return [self getMacAddress];
|
|
|
}
|
|
|
|
|
|
- (NSDictionary *)jsonDictionary
|
|
|
{
|
|
|
return @{
|
...
|
...
|
@@ -111,7 +108,7 @@ NSString * const JsonKeyDeviceMAC = @"mac"; |
|
|
|
|
|
|
|
|
#pragma mark - method
|
|
|
- (NSString *)getMacAddress
|
|
|
+ (NSString *)getMacAddress
|
|
|
{
|
|
|
int mgmtInfoBase[6];
|
|
|
char *msgBuffer = NULL;
|
...
|
...
|
@@ -132,13 +129,13 @@ NSString * const JsonKeyDeviceMAC = @"mac"; |
|
|
if ((mgmtInfoBase[5] = if_nametoindex("en0")) == 0) {
|
|
|
errorFlag = @"if_nametoindex failure";
|
|
|
} else if (sysctl(mgmtInfoBase, 6, NULL, &length, NULL, 0) < 0) {
|
|
|
// Get the size of the data available (store in len)
|
|
|
// Get the size of the data available (store in len)
|
|
|
errorFlag = @"sysctl mgmtInfoBase failure";
|
|
|
} else if ((msgBuffer = malloc(length)) == NULL) {
|
|
|
// Alloc memory based on above call
|
|
|
// Alloc memory based on above call
|
|
|
errorFlag = @"buffer allocation failure";
|
|
|
} else if (sysctl(mgmtInfoBase, 6, msgBuffer, &length, NULL, 0) < 0) {
|
|
|
// Get system information, store in buffer
|
|
|
// Get system information, store in buffer
|
|
|
errorFlag = @"sysctl msgBuffer failure";
|
|
|
}
|
|
|
|
...
|
...
|
|