我正在使用 MFMailComposer。我向 gmail 发送电子邮件,MFMailComposer 返回 MFMailComposeResultSent 状态。但我没有收到任何电子邮件。我用 4.3.4 在 iphone4 上进行了测试。我做错了什么?
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:在带有 4.3.4 的 iPhone4 上不起作用,但在带有 4.3 的 ipod 上工作正常。