Reputation: 7377
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
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
Reputation: 33101
if ([MFMailComposeViewController canSendMail]) {
[self doStuff];
}
Upvotes: 23