I have a iphone app that has the capability to send messages. I want to alert user when sim card is not available in iphone. So i tried below three function to check sim car
Complementing to Anneq and Felipe answers:
Swift 2.3:
import CoreTelephony
func isSimAvailable() -> Bool {
let info = CTTelephonyNetworkInfo()
let carr = info.subscriberCellularProvider
guard let carrier = carr else {
return false
}
guard let carrierCode = carrier.mobileNetworkCode else {
return false
}
guard carrierCode != "" else {
return false
}
return true
}