尽管应用程序似乎运行良好,但我没有收到任何电子邮件

Even though app seems to be working fine i did not receive any email

我制作了一个可以拍照的相机应用程序,拍完照片后,我会点击一个 ui 按钮来撰写一封邮件,并将该图像作为附件。一切似乎都工作正常,甚至在撰写电子邮件时也可以看到附件中的图像文件。当点击 'send' 并打开我的电子邮件 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 设备上的邮件应用程序访问 "Mobile Data"。因此,请不要忘记允许该访问,因为您的设备将通过您登录时使用的 Apple ID 发送邮件。