iPhone 中从 MFMailComposeViewController 发送邮件时显示成功提醒消息
当用户使用 MFMailComposeViewController 从 iPhone 成功发送邮件时,我需要显示警报消息。
我尝试使用 didFinishWithResult 委托,但它同时要求发送和取消,那么我们如何确定我们成功发送了消息?
I need to display the alert message when the user send successfully mail from the iPhone using MFMailComposeViewController.
I tried with didFinishWithResult delegate but it is calling for both send and cancel then how we can determine we successfully send the message?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我对这种方法遇到了麻烦。在我的应用程序中,我使用 MFMailComposeViewController 处理电子邮件,使用 MFMessageComposeViewController 处理短信,两个 didFinishWithResult 例程都使用与上述方法类似的方法,在 VC 关闭之前显示警报。
似乎如果您发送短信,下次尝试发送电子邮件时,光标将不会出现在电子邮件正文中,并且您无法选择任何文本。另外,在调试器中,我收到“wait_fences:无法接收回复:10004003”。
我最终只是从应用程序的这一部分删除了警报视图,问题就消失了。如果有人对这个问题有解决方案,我很高兴听到。
I had trouble with this approach. In my app I used MFMailComposeViewController for email and MFMessageComposeViewController for SMS messages and both didFinishWithResult routines used a similar approach to the one above, where an alert is shown before the VC is dismissed.
It seemed that if you sent an SMS, the next time you tried an email the cursor would not appear in the email body and you could not select any text. Also in the debugger I was getting "wait_fences: failed to receive reply: 10004003".
I eventually just removed the alert views from this part of the app and the problem went away. If anyone has a resolution for this issue I'd be glad to hear it.
您应该为委托对象实现此方法...
查看更多详细信息... http://developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMailComposeViewControllerDelegate_protocol/Reference/Reference.html#//apple_ref/occ/intf/MFMailComposeViewControllerDelegate
you should implement this method for the delegate object...
look at this for more detail... http://developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMailComposeViewControllerDelegate_protocol/Reference/Reference.html#//apple_ref/occ/intf/MFMailComposeViewControllerDelegate
使用此委托,并且此 MFMailComposeResult 内部是一个枚举
Use this delegate and inside this MFMailComposeResult is an enum
答案的快速版本。
Swift Version of the Answer.