2017-07-18 48 views
0

我做了一个照相机应用程序,需要一张照片,一旦拍摄照片,我点击一个uibutton组成一封附带该图像的邮件。在编写电子邮件时,即使附件中的图像文件可以看到,一切似乎都能正常工作。当点击'发送',并打开我的电子邮件ID,我没有收到任何新的收件箱。这里是代码即使应用程序似乎工作正常我没有收到任何电子邮件

func sendEmail() { 
    let composeVC = MFMailComposeViewController() 
    composeVC.mailComposeDelegate = self 
    // Configure the fields of the interface. 
    composeVC.setToRecipients([email]) 
    composeVC.setSubject("Hello!") 
    composeVC.setMessageBody("Hello this is my message body!", isHTML: false) 
    let imageData: NSData = UIImagePNGRepresentation(pickedImage.image!)! as NSData 
    composeVC.addAttachmentData(imageData as Data, mimeType: "image/jpeg", fileName: name) 
    // Present the view controller modally. 
    self.present(composeVC, animated: true, completion: nil) 
} 

func mailComposeController(_ controller: MFMailComposeViewController, 
          didFinishWith result: MFMailComposeResult, error: Error?) { 
    controller.dismiss(animated: true, completion: nil) 
} 
+0

检查您的发件箱。 – rmaddy

+0

也没有。 – N4SK

+0

发现此问题。我的iOS设备上不允许“移动数据”访问邮件应用程序。 – N4SK

回答

0

我发现这个问题&那是因为我没有让上的“移动数据”我的iOS设备访问邮件应用程序。因此,不要忘记允许访问,因为您的设备将通过您登录的Apple ID发送邮件。

相关问题