ios4.3.4:MFMailComposer不发送电子邮件,但返回MFMailComposeResultSent状态 [英] ios4.3.4: MFMailComposer doesn't send an email, but return MFMailComposeResultSent status
问题描述
我正在使用MFMailComposer.我将电子邮件发送到gmail,MFMailComposer返回MFMailComposeResultSent状态.但是我没有收到任何电子邮件.我在4.3.4的iphone4上进行了测试.我做错了什么?
I am using MFMailComposer. I send email to gmail, MFMailComposer returns MFMailComposeResultSent status. But I don't received any email. I tested on iphone4 with 4.3.4. What I do wrong?
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];
}
}
我在控制台中找到了它:
I found this in console :
DA|Could not open the lock file at /tmp/DAAccountsLoading.lock. We'll load the accounts anyway, but bad things may happen
在iPhone 4.4.3上无法正常运行,但在ipod 4.3上可以正常运行.
On iPhone4 with 4.3.4 doesn't work, but on ipod with 4.3 works OK.
推荐答案
您没有做错任何事情.在Apple网站上检查以下行:
You do nothing wrong. Check this line from Apple's website:
MFMailComposeResultSent
– 电子邮件已在用户的发件箱中排队.准备在下次用户连接到电子邮件时发送.
MFMailComposeResultSent
– The email message was queued in the user’s outbox. It is ready to send the next time the user connects to email.
这篇关于ios4.3.4:MFMailComposer不发送电子邮件,但返回MFMailComposeResultSent状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!