why do serviceSubscriberCellularProviders return nil? (in iOS 12)

前端 未结 2 1809
面向向阳花
面向向阳花 2021-02-06 10:28

Question about CTCarrier from CoreTelephony. I heard that I should use serviceSubscriberCellularProviders instead of subscriberCellularProvider in iOS 12 because subscriberCellu

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-06 11:20

    I think it's an Apple's bug. Try this:

        CTTelephonyNetworkInfo *networkStatus = [[CTTelephonyNetworkInfo alloc] init];
    if (@available(iOS 12.0, *)) {
        NSDictionary *info = networkStatus.serviceSubscriberCellularProviders;
        NSLog(@"%@", [networkStatus valueForKey:@"serviceSubscriberCellularProvider"]);
    }
    

    It works well on iPhone XS Max (double Sim cards).And it seems to be a private method.

提交回复
热议问题