Sam Jarman
Sam Jarman

Reputation: 7377

Check if user has email set up on their iDevice?

How do you check (programmatically) if a user has set up an email account in Mail.app. It seems to be causing a crash.

Cheers

Upvotes: 9

Views: 1886

Answers (2)

Vin
Vin

Reputation: 456

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.

}

Upvotes: 0

coneybeare
coneybeare

Reputation: 33101

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

Upvotes: 23

Related Questions