Get CellID, MCC, MNC, LAC, Signal Strength, Quality and Network in iOS 8.3

How to get the cell id using private apis in ios 8.3, since the previous private service of the main telephony does not work in the latest ios sdk 8.3.

+4
source share
2 answers

You can still use this. It works on iOS 8.3. I do not know how to get signal strength. Recently, Apple has changed a lot in Core Telephony. :(

CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new];
NSString *carrierNetwork = telephonyInfo.currentRadioAccessTechnology;
NSLog(@"Mobile Network): %@", carrierNetwork);

CTCarrier *carrier = [telephonyInfo subscriberCellularProvider];

NSString *mobileCountryCode = [carrier mobileCountryCode];
NSLog(@"Mobile Country Code (MCC): %@", mobileCountryCode);

NSString *mobileNetworkCode = [carrier mobileNetworkCode];
NSLog(@"Mobile Network Code (MNC): %@", mobileNetworkCode);

NSString *carrierName = [carrier carrierName];
NSLog(@"Mobile Network name: %@", carrierName);

NSString *isoCountryCode = [carrier isoCountryCode];
NSLog(@"Mobile Network isoCode: %@", isoCountryCode);

Edit: I found a solution on how to get signal strength. *! Please note that the solution below uses a private API and thus will be rejected by Apple when it is submitted to the App Store.

UIApplication *app = [UIApplication sharedApplication];
NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];
NSString *dataNetworkItemView = nil;

for (id subview in subviews) {
    if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarSignalStrengthItemView") class]]) {
        dataNetworkItemView = subview;
        break;
    }
}

int signalStrength = [[dataNetworkItemView valueForKey:@"signalStrengthRaw"] intValue];

NSLog(@"signal %d", signalStrength);
+5

CellID, MCC, MNC, LAC iOS 5.1

, lac cell ios 8.2. lac cell ios 8.3, :

<key>com.apple.CommCenter.fine-grained</key>
<array>
    <string>spi</string>
</array>

, .

, . , , .

0

Source: https://habr.com/ru/post/1584003/


All Articles