简体   繁体   English

等到iOS上发送了一封电子邮件?

[英]Waiting until an email has been sent on iOS?

My app allows the user to send an email through MFMailComposeViewController. 我的应用程序允许用户通过MFMailComposeViewController发送电子邮件。 While the email is being sent, I'd like to display an activity indicator. 在发送电子邮件时,我想显示一个活动指示器。 Problem is I can't find a way to know when it's been sent. 问题是我无法找到一种方法来知道它何时被发送。 The delegate is only being told whether the mail was placed in the outbox: 只告知代表邮件是否放在发件箱中:

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error

Is there any way to know whether an email has been sent on iOS? 有没有办法知道是否已在iOS上发送电子邮件?

I think you're out of luck, sort of. 我觉得你运气不好。 Once the email gets passed to the Mail app, you lose track of it, and it becomes the responsibility of the Mail app alone. 一旦电子邮件传递给Mail应用程序,您就会忘记它,并且它将成为Mail应用程序的责任。 And there isn't a way to even poll the Mail app to determine if an email has been sent. 并且甚至没有办法甚至可以轮询Mail应用以确定是否已发送电子邮件。

But as long as the device has a network connection and the user has an email account set up, you're pretty much guaranteed the email will be sent, assuming you don't get an error returned to you. 但只要设备具有网络连接并且用户设置了电子邮件帐户,您就可以保证发送电子邮件,假设您没有收到错误。 And you can always pre-check for network connectivity and email access before you attempt to present the MFMailComposeViewController. 在尝试呈现MFMailComposeViewController之前,您始终可以预先检查网络连接和电子邮件访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM