Search code examples
iphoneiossmssim-cardcore-telephony

When SIM is not available how should we handle MFMessageComposeViewController


I am using MFMessageComposeViewController to send text message via my App. But I have a problem when we remove the SIM and try to send message. Is there any delegate available to track whether the message will be sent / not?


Solution

  • You can use the CTTelephonyNetworkInfo class of the core telephony framework to gather information about the SIM card. Use the subscriberCellularProviderDidUpdateNotifier method to get notified about SIM card changes:

    A block object that is dispatched on the default priority global dispatch queue when the user’s cellular provider information changes. This occurs, for example, if a user swaps the device’s SIM card with one from another provider, while your application is running.