Reputation: 1775
Iphone 4 MFMailComposeViewController
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setMessageBody:@"Welcome" isHTML:NO];
[controller release];
My app to be crash.
Wat i did wrong
Regards, Arun
Upvotes: 0
Views: 572
Reputation: 8488
The mail composer will crash if the user is unable to send mail. First check to see if the user is able to send mail before trying to instantiate a MFMailComposeViewController.
if([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController* controller = [[[MFMailComposeViewController alloc] init] autorelease];
//...
}
Upvotes: 2
Reputation: 3012
init failed, because not iOS mail-application's setting.
MFMailComposeViewController* controller = [[[MFMailComposeViewController alloc] init] autorelease];
if (!controller) // failed
return; // auto view alert, "not mail setting..."
controller.mailComposeDelegate = self;
Upvotes: -1
Reputation: 954
As Akira says, you can use MFMailComposeViewController after you set up the device's e-mail settings.
Upvotes: 0
Reputation: 1775
@Arun , First up all configure the email settings in your device
Upvotes: 0