...
|
...
|
@@ -26,8 +26,8 @@ |
|
|
self = [super init];
|
|
|
if (self) {
|
|
|
self.ps = @"0";
|
|
|
self.ca = [self getCurrentCa];
|
|
|
self.idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
|
|
|
[self loadCarrierInfo];
|
|
|
}
|
|
|
|
|
|
return self;
|
...
|
...
|
@@ -39,6 +39,13 @@ |
|
|
}
|
|
|
}
|
|
|
|
|
|
- (NSString *)ca {
|
|
|
if (!_ca || [_ca isEqualToString:kCarrierCodeChinaUnknown]) {
|
|
|
[self loadCarrierInfo];
|
|
|
}
|
|
|
return _ca;
|
|
|
}
|
|
|
|
|
|
- (NSString*)ch
|
|
|
{
|
|
|
_ch = [[YHEventReport sharedInstance] channelId];
|
...
|
...
|
@@ -125,23 +132,40 @@ |
|
|
return _net;
|
|
|
}
|
|
|
|
|
|
- (NSString *)getCurrentCa
|
|
|
- (void)loadCarrierInfo
|
|
|
{
|
|
|
NSString *currentCa = kCarrierCodeChinaUnknown;
|
|
|
CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
|
|
|
CTCarrier *carrier = [netInfo subscriberCellularProvider];
|
|
|
|
|
|
// 中国移动
|
|
|
if ([carrier.mobileNetworkCode isEqualToString:@"00"] || [carrier.mobileNetworkCode isEqualToString:@"02"] || [carrier.mobileNetworkCode isEqualToString:@"07"]) {
|
|
|
return kCarrierCodeChinaMobile;
|
|
|
} else if([carrier.mobileNetworkCode isEqualToString:@"01"] || [carrier.mobileNetworkCode isEqualToString:@"06"]) { // 中国联通
|
|
|
return kCarrierCodeChinaUnicom;
|
|
|
}else if([carrier.mobileNetworkCode isEqualToString:@"03"] || [carrier.mobileNetworkCode isEqualToString:@"05"]) { // 中国电信
|
|
|
return kCarrierCodeChinaTelecom;
|
|
|
} else if([carrier.mobileNetworkCode isEqualToString:@"20"]){ // 中国铁通
|
|
|
return kCarrierCodeChinaTietong;
|
|
|
NSString *const chinaMCC = @"460";
|
|
|
_mcc = [carrier.mobileCountryCode copy] ?: @"";
|
|
|
_mnc = [carrier.mobileNetworkCode copy] ?: @"";
|
|
|
if (carrier.mobileCountryCode) {
|
|
|
if ([carrier.mobileCountryCode isEqualToString:chinaMCC]) {
|
|
|
NSArray *const chinaMobile = @[ @"00", @"02", @"07" ];// 中国移动
|
|
|
NSArray *const chinaUnicom = @[ @"01", @"06", @"09" ];// 中国联通
|
|
|
NSArray *const chinaTelecom = @[ @"03", @"05", @"11" ];// 中国电信
|
|
|
NSArray *const chinaTietong = @[ @"20" ];// 中国铁通
|
|
|
NSString *const mnc = [carrier.mobileNetworkCode copy];
|
|
|
if ([chinaMobile containsObject:mnc]) {
|
|
|
currentCa = kCarrierCodeChinaMobile;
|
|
|
} else if ([chinaUnicom containsObject:mnc]) {
|
|
|
currentCa = kCarrierCodeChinaUnicom;
|
|
|
} else if ([chinaTelecom containsObject:mnc]) {
|
|
|
currentCa = kCarrierCodeChinaTelecom;
|
|
|
} else if ([chinaTietong containsObject:mnc]) {
|
|
|
currentCa = kCarrierCodeChinaTietong;
|
|
|
}
|
|
|
} else {
|
|
|
currentCa = kCarrierCodeOverseas;
|
|
|
}
|
|
|
}
|
|
|
if ([currentCa isEqualToString:kCarrierCodeChinaUnknown]) {
|
|
|
currentCa = [[NSUserDefaults standardUserDefaults] objectForKey:NSStringFromSelector(_cmd)] ?: kCarrierCodeChinaUnknown;
|
|
|
} else {
|
|
|
return kCarrierCodeChinaUnknown;
|
|
|
[[NSUserDefaults standardUserDefaults] setObject:currentCa forKey:NSStringFromSelector(_cmd)];
|
|
|
}
|
|
|
_ca = [currentCa copy];
|
|
|
}
|
|
|
|
|
|
-(NSString *)uid{
|
...
|
...
|
|