应用内电子邮件发出swoosh声音,但不发送

时间:2013-01-28 19:55:24

标签: ios objective-c email mfmailcomposeviewcontroller

我很好地接受了Mail程序,当我按下“发送”时,我听到swoosh声音并且Mail关闭并将我返回到我的应用程序,但实际的邮件没有发送。

这是我用来邮寄的代码。关于我做错了什么的想法?

(我在实际设备上使用的是iOS6,而不是模拟器。)

-(void)openMail {

            //Open Mail program and create email with haiku attached as image.

if ([MFMailComposeViewController canSendMail])
{
    MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
    mailer.mailComposeDelegate = self;
    [mailer setSubject:[NSString stringWithFormat:@"subject"]];
    UIImage *myImage = [self createImage];
    NSData *imageData = UIImagePNGRepresentation(myImage);
    [mailer addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"xxxxx"];
    NSString *emailBody = @"I thought you might like this haiku from the xxxxx iPhone app.";
    [mailer setMessageBody:emailBody isHTML:NO];
    [self presentViewController:mailer animated:YES completion:NULL];
}

            //Unless it's not possible to do so, in which case show an alert message.

else
{
    self.alert = [[UIAlertView alloc] initWithTitle:@"I'm sorry." message:@"Your device doesn't seem to be able to email this haiku. Perhaps you'd like to tweet it or post it on Facebook instead?" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [self.alert show];
}
}

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[self dismissViewControllerAnimated:YES completion:Nil];
}

1 个答案:

答案 0 :(得分:1)

看起来我的服务器和iOS 6.1更新之间实际上存在问题。如果其他人遇到同样的问题,我会留下这个。如果问题得到解决,我的电子邮件STILL将不会发送,那么我将发布另一个问题。