- CFStringRef (*$CTSIMSupportCopyMobileSubscriberCountryCode)(CFAllocatorRef);
- $CTSIMSupportCopyMobileSubscriberCountryCode = reinterpret_cast<CFStringRef (*)(CFAllocatorRef)>(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode"));
- CFStringRef mcc($CTSIMSupportCopyMobileSubscriberCountryCode == NULL ? NULL : (*$CTSIMSupportCopyMobileSubscriberCountryCode)(kCFAllocatorDefault));
-
- CFStringRef (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(CFAllocatorRef);
- $CTSIMSupportCopyMobileSubscriberNetworkCode = reinterpret_cast<CFStringRef (*)(CFAllocatorRef)>(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberNetworkCode"));
- CFStringRef mnc($CTSIMSupportCopyMobileSubscriberNetworkCode == NULL ? NULL : (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(kCFAllocatorDefault));
-
- if (mcc != NULL && mnc != NULL)
- if (CFStringGetLength(mcc) == 3) {
- CFIndex length(CFStringGetLength(mnc));
- if (length == 2 || length == 3) {
- PLMN_ = [NSString stringWithFormat:@"%@%@", mcc, mnc];
-
- Pcre pattern("^[0-9]{5,6}$");
- if (!pattern(PLMN_))
- PLMN_ = nil;
- }
- }
-
- if (mnc != NULL)
- CFRelease(mnc);
- if (mcc != NULL)
- CFRelease(mcc);
-