检查用户是否在其iDevice上设置了电子邮件?

时间:2010-12-23 21:58:44

标签: iphone email iphone-sdk-3.0

如何(以编程方式)检查用户是否在Mail.app中设置了电子邮件帐户。它似乎导致了崩溃。

干杯

2 个答案:

答案 0 :(得分:22)

if ([MFMailComposeViewController canSendMail]) {
    [self doStuff];
}

答案 1 :(得分:0)

Class mailClass =(NSClassFromString(@"MFMailComposeViewController"));
if(mailClass!=nil)
{
    if ([mailClass canSendMail]) 
    {

        [self displayMailComposerSheet]; 
       //compose box
    }else
    {
       //email account not setup on the device.
    }
}else 
{
 // problem in loading mail setup.

}