ios4.3.4:MFMailComposer不发送电子邮件,但返回MFMailComposeResultSent状态
问题描述:
我正在使用MFMailComposer。我发送电子邮件给Gmail,MFMailComposer返回MFMailComposeResultSent状态。但我没有收到任何电子邮件。我用4.3.4在iphone4上测试过。我做错了什么?ios4.3.4:MFMailComposer不发送电子邮件,但返回MFMailComposeResultSent状态
MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init];
mailPicker.mailComposeDelegate = self;
// Set the subject of email
[mailPicker setSubject:@"Subject"];
NSString *emailBody = @"Hello from ios";
// This is not an HTML formatted email
[mailPicker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailPicker animated:YES];
[mailPicker release];
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
if (result == MFMailComposeResultFailed)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[error description] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
if (result == MFMailComposeResultSent)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Message has been sent" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
else
{
[self dismissModalViewControllerAnimated:YES];
}
}
编辑:我发现这个控制台:
DA|Could not open the lock file at /tmp/DAAccountsLoading.lock. We'll load the accounts anyway, but bad things may happen
EDIT2:在iPhone4采用4.3.4不工作,而是在iPod 4.3工程确定。
答
你没有做错任何事。从苹果公司的网站上查询这一行:
MFMailComposeResultSent
- 该电子邮件用户的发件箱排队。它准备在用户下次连接到电子邮件时发送。
也许它被过滤掉为垃圾邮件? – Yahia
我看着Gmail垃圾邮件,但我没有发现任何iPhone的邮件。 – Voloda2
您是否尝试重新启动设备以清除/ tmp目录内容?也许这可以消除造成你麻烦的锁 – viggio24