开发者

Iphone 4 MFmailcompose viewcontroller crash

     Iphone 4 MFMailComposeViewController 



     MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
    controller.mailComposeDelegate = self;
    [controller s开发者_JAVA技巧etMessageBody:@"Welcome" isHTML:NO];
    [controller release];

  My app to be crash.
  Wat i  did wrong

Regards, Arun


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];
   //...

}


@Arun , First up all configure the email settings in your device


As Akira says, you can use MFMailComposeViewController after you set up the device's e-mail settings.


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;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜