开发者

Check if user has email set up on their iDevice?

开发者 https://www.devze.com 2023-02-01 14:10 出处:网络
How do you check (programmatically) if 开发者_StackOverflow中文版a user has set up an email account in Mail.app. It seems to be causing a crash.

How do you check (programmatically) if 开发者_StackOverflow中文版a user has set up an email account in Mail.app. It seems to be causing a crash.

Cheers


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


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.

}
0

精彩评论

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