开发者

detect if the iPhone / iPad email client was configured / valid

I had an issue with an application crashing badly while opening MFMailComposeViewController, it was working p开发者_JAVA技巧erfectly 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜