I had an issue with an application crashing badly while opening MFMailComposeViewController
, it was working perfectly on the simulator and crashed on the device.
After spending some hours I realized that the reason was that the internal email client on the iPad I am using for testing was not set / configured - after setting an email on the device, all worked fine.
Thus my question: can I detect if the device email client was configured and valid to avoid the same crash again on devices which did not yet set their internal iPad / iPhone email client?
Just check the canSendMail class method:
if ([MFMailComposeViewController canSendMail]) {
// Yes we can send mail.
}
What I do is check the method and only display the mail option if it return true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With