在iOS 8.3中获取CellID,MCC,MNC,LAC,信号强度,质量和networking

如何在ios 8.3中使用私有apis获取cell id,因为之前的核心电话私有apis在最新的ios sdk 8.3中不起作用。

你仍然可以使用这个。 它在iOS 8.3上工作。 我不知道如何获得信号强度。 最近苹果公司在核心电话方面已经改变了很多。 🙁

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); 

编辑:我发现解决scheme如何获得信号强度。 *! 请注意,下面的解决scheme使用私有API,因此当提交到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); 

在iOS 5.1中获取CellID,MCC,MNC,LAC和networking

你可以访问上面的链接,并且可以得到ios 8.2下面的lac和cell。 如果你想得到超过ios 8.3的lac和cell,你应该添加权限:

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

还有,它说你的手机需要越狱。

但是,真的,我不能尝试真正的手机。 如果你成功了,分享,谢谢。