Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why do serviceSubscriberCellularProviders return nil? (in iOS 12)

Question about CTCarrier from CoreTelephony. I heard that I should use serviceSubscriberCellularProviders instead of subscriberCellularProvider in iOS 12 because subscriberCellularProvider would be deprecated. So I wrote following codes.

import UIKit
import CoreTelephony

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        let telephony = CTTelephonyNetworkInfo()
        if #available(iOS 12.0, *) {
            let carrier = telephony.serviceSubscriberCellularProviders
            print(carrier)
        }
        else {
            let carrier = telephony.subscriberCellularProvider
            print(carrier)
        }
        
    }

}

SubscriberCellularProvider successfully return right SIM card information, however, serviceSubscriberCellularProviders just return nil value.

Do you know why happens like this? Please help me

like image 962
HyunJin Yoon Avatar asked Oct 17 '18 02:10

HyunJin Yoon


1 Answers

It's a bug in iOS 12.0.x, and it has fixed in iOS 12.1

like image 98
santos Avatar answered Oct 23 '22 15:10

santos