I am developing an iOS application where I need to detect if a SIM card is inserted in the device(either physical / eSim). I am targeting iOS 12 and later. I have tried using CTTelephonyNetworkInfo and CTSubscriber, but I am encountering issues with permissions and API availability in iOS 18 beta 3.
if #available(iOS 16.0, *) {
let subscriber = CTSubscriber()
if #available(iOS 18.0, *) {
do {
if subscriber.isSIMInserted {
return "SIM card is inserted."
} else {
return "No SIM card detected."
}
} catch {
return "Error determining if SIM is inserted: \(error.localizedDescription)"
}
} else {
return "isSIMInserted is only available on iOS 18.0 or newer."
}
} else {
return "isSIMInserted is only available on iOS 16.0 or newer."
}
if let carriers = networkInfo.serviceSubscriberCellularProviders,
let carrier = carriers.first?.value,
let _ = carrier.mobileNetworkCode {
return "SIM card is available.\nCarrier Name: \(carrier.carrierName ?? "None")"
} else {
return "No SIM card installed"
}
}
in iOS 18 it always returning No SIM card detected.
XCode Version 16.0 beta 3 (16A5202i)
iPhone OS: iOS 18.0 (22A5307i)
is there anything did I miss? or any documentation for the implementation would be helpful.
Thanks
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I am experiencing an issue with NFC scanning on my iPhone 11 after updating to iOS 18. Previously, I was able to use NFC tags without any problems. However, since the update, the NFC functionality no longer works as expected.
Installed OS: iOS 18.0 (22A3354)
Here are the troubleshooting steps I have already tried:
Opened the Shortcuts app.
Tapped on Automation.
Searched for NFC.
Selected Run after confirmation.
Tapped NFC Tag -> Scan.
Unfortunately, nothing happens at this point; the NFC scan doesn't initiate.
This issue has made it difficult for me to use NFC-dependent automations and functionalities that worked seamlessly before the update. Could you please provide guidance on how to resolve this problem?
Thank you for your attention and support.
I am developing an iOS application. In that i should show a status of their cellular provider such as Active, Inactive, or sim not available. Which also includes physical and eSim. I used Telephony.CTcarrier. One thing its deprecated and another case iOS 15 and below, even if i put my device in Airplane mode still its returning the carrierName and NetworkCode.
Is there any specific API to retrieve these realtime data?
TIA