How to programmatically detect MCC and MNC code of eSIM in iPhone?
You can, for the moment, use Core Telephony for this. See the mobileCountryCode
and mobileNetworkCode
properties on CTCarrier
.
CT will give you these values for all active SIMs. There’s no good way to determine which is a hardware SIM and which is an eSIM.
Also, it’s likely that a future version of iOS will stop returning meaningful values here. See deprecation comments in <CoreTelephony/CTCarrier.h>
.
how can I identify whether internet mobile data is connected through
There’s no supported way to do that on the device itself. Indeed, it’s not hard to imagine a world where this question itself makes no sense, in that we might use different SIMs for different network destinations. [See Scott’s reply below.]
Are you working on behalf of a carrier?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"