2015-04-22 263 views

回答

5

你仍然可以使用它。它在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); 

编辑:我找到的解决方案如何获得的信号强度 *请注意,下面的解决方案使得使用私有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); 
+0

从这我只能得到MNC和MCC,但我正在寻找细胞ID,LAC和信号强度,这是使用私人APIS befor 8.3,但现在不能在新的升级工作。任何更新相同? –

+1

我知道这篇文章比较老,但想知道是否有人找到了解决这个问题的方法 – RockPaperScissors

+0

没有。有一个解决方案,但只适用于越狱设备。 –

0

Get CellID, MCC, MNC, LAC, and Network in iOS 5.1

,您可以访问上面的链接,并且可以得到下面的ios LAC和电池8.2 如果你想获得LAC和电池上面搭载iOS 8.3版本,您应该添加的权利:

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

另外,它说你的手机需要越狱。

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

相关问题