无法在模拟器中使用MFMailComposeViewController发送电子邮件 [英] Unable to send email using MFMailComposeViewController in simulator

查看:169
本文介绍了无法在模拟器中使用MFMailComposeViewController发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ios app开发的新手,下面是我用来发送电子邮件的代码。

I am new to ios app development, Below is the code I used to send an email.

   MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
    controller.mailComposeDelegate = self;
    [controller setSubject:@"My Subject"];
    [controller setMessageBody:@"Hello there." isHTML:NO]; 
    [self presentModalViewController:controller animated:YES];
    [controller release];



    - (void)mailComposeController:(MFMailComposeViewController*)controller  
                  didFinishWithResult:(MFMailComposeResult)result 
                                error:(NSError*)error {

          if (result == MFMailComposeResultSent) {

              NSLog(@"It's away!");
          }

          [self dismissModalViewControllerAnimated:YES];
    }

不幸的是委托方法永远不会被触发,任何人都可以建议我如何检查我的电子邮件通过模拟器?

Unfortunately delegate methods are never triggered , Can any one please suggest how can i check my email via simulator?

推荐答案

不能通过模拟器发送邮件。

You CANNOT send mails through Simulator.

相反,您可以在设备中安装该应用程序并从那里尝试。

Instead you can install the application in device and try from there.

模拟器只显示作曲家但不会允许您发送邮件。已成功发送只是确认您的代码正常,并且在发送时没有终止它的问题。

Simulator just displays the composer but wont allow you to send mails. Sent Successfully is just the acknowledgment that your code is fine and there is no issue that terminates it while sending.

这篇关于无法在模拟器中使用MFMailComposeViewController发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆