【问题标题】:Even though app seems to be working fine i did not receive any email即使应用程序似乎运行良好,我也没有收到任何电子邮件
【发布时间】:2017-12-23 22:35:56
【问题描述】:

我制作了一个可以拍照的相机应用程序,一旦拍照,我点击一个 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 设备上的邮件应用程序。
  • 如果您认为它会帮助他人,可以将其作为答案发布,或者删除您的问题。

标签: ios swift mfmailcomposeviewcontroller


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-03
    • 2013-03-13
    • 1970-01-01
    • 2018-06-01
    • 1970-01-01
    相关资源
    最近更新 更多