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
It's a bug in iOS 12.0.x, and it has fixed in iOS 12.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With