15

For iOS 16, CTCarrier looks to have been deprecated.

https://developer.apple.com/documentation/coretelephony/ctcarrier

What will be the correct way, going forward, to receive information regarding carrier information such as MCC, MNC, and ISO country codes?

At my company, we use this information as data points to assist in scammer detection and a few other small but relatively important things, such as: limiting Phone Number logins from countries / carriers we do not support for pricing reasons.

I cant find any WWDC videos on the reason behind this deprecation or what any new classes may be that will support this information.

daredevil1234
  • 1,303
  • 1
  • 10
  • 34
  • 5
    My expectation is that there is no replacement. This is the kind of functionality that Apple has a history of removing. I would open a DTS and ask Apple directly. Note that deprecated functions often continue to exist for a long time (though I would guess these were removed to prevent fingerprinting, so they may go away more quickly). Explaining to Apple your use case and exactly how you're using this information and how it helps your customers can sometimes lead to new APIs to support those use cases, and sometimes slows the removal of the API (though it may still be deprecated) – Rob Napier Aug 08 '22 at 22:37
  • 4
    Interestingly, CTTelephonyNetworkInfo and serviceSubscriberCellularProviders are both not deprecated. serviceSubscriberCellularProviders returns CTCarrier https://developer.apple.com/documentation/coretelephony/cttelephonynetworkinfo/3024511-servicesubscribercellularprovide?language=objc&changes=latest_major – AutomatonTec Sep 07 '22 at 16:40
  • serviceSubscriberCellularProviders returns a carrier regardless of if the SIM is inserted or not =( – Hogdotmac May 09 '23 at 09:15

2 Answers2

1

They will deprecate that in a later iOS version. In iOS 16.4 they return a static string for CTCarrier.isoCountryCode. We detected that via bug reports in our apps :-(

We will replace this with the following information from Locale for the assumption that users usually keep the device region of their home country and so have the same ISO country code of the SIM card. I know that is not always correct but it is the closest that we can get now:

Locale.current.regionCode
blackjacx
  • 9,011
  • 7
  • 45
  • 56
0

If you want to find the user's country, you can use the time. The TimeZone is always right for example in swift:

let identifier = TimeZone.current.identifier
print(identifier) //return => Asia/Tehran
wanted
  • 41
  • 3
  • this doesn't really work for all use cases. For example, if the user is a US based carrier and travels to a different country, and their timezone changes – daredevil1234 Jul 24 '23 at 22:44