如何通过iPhone XR或iPhoneXS Max的双SIM卡获得蜂窝数据SIM卡的载体。我有两张卡的运营商信息,但找不到一个蜂窝数据。
CTCarrier *carrier;
if (@available(iOS 12.1, *)) {
if ([self.telephonyNetworkInfo respondsToSelector:@selector(serviceSubscriberCellularProviders)]) {
NSArray *carrierInfos = [[self.telephonyNetworkInfo performSelector:@selector(serviceSubscriberCellularProviders)] allValues];
if (carrierInfos && [carrierInfos count] > 0) {
carrier = carrierInfos[0];
}
}
} else if (@available(iOS 12.0, *)) {
if ([self.telephonyNetworkInfo respondsToSelector:@selector(serviceSubscriberCellularProvider)]) {
NSArray *carrierInfos = [[self.telephonyNetworkInfo performSelector:@selector(serviceSubscriberCellularProvider)] allValues];
if (carrierInfos && [carrierInfos count] > 0) {
carrier = carrierInfos[0];
}
}
}
if (!carrier) {
carrier = [self.telephonyNetworkInfo subscriberCellularProvider];
}
调试信息: xcode console lldb info