即使应用程序似乎运行良好,我也没有收到任何电子邮件



我制作了一个拍照的相机应用程序,一旦拍照,我点击一个ui按钮来撰写一封带有该图像作为附件的邮件。 一切似乎都正常,即使在撰写电子邮件时也可以看到附件中的图像文件。 点击"发送"并打开我的电子邮件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)
}

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

相关内容

最新更新