【问题标题】:Empty email body on iPad using UIActivityViewController使用 UIActivityViewController 在 iPad 上清空电子邮件正文
【发布时间】:2015-06-28 23:38:48
【问题描述】:

我正在使用 UIActivityViewController 将共享添加到我的应用程序。一切都在 iPhone 上按预期工作,但在 iPad 上,邮件视图控制器在点击“UIActivityViewController”的电子邮件图标后被调出,但电子邮件正文未设置(使用text1)并且电子邮件视图控制器处于非活动状态并且不允许用户输入收件人。

            let text1 = "this is the body of the email"
            self.finalizeDocument()
            let controller = UIActivityViewController(activityItems: [text1], applicationActivities: nil)
            controller.setValue("Siged document is attached", forKey: "subject")
            if let ppc = controller.popoverPresentationController {
                ppc.barButtonItem = self.shareButton!
            }
            self.presentViewController(controller, animated: true, completion: nil)

【问题讨论】:

    标签: ios ipad email uiactivityviewcontroller


    【解决方案1】:

    事实证明,重新启动 iPad 解决了这个问题。

    【讨论】:

    • 疯了,但这里是一样的,关闭再打开代码开始工作。
    【解决方案2】:

    嘿,试试这样的

    1. 导入消息库
    2. 将邮件委托添加到类中
    3. 撰写并发送您的信息

      import MessageUI
      
      class ViewController: UIViewController, MFMailComposeViewControllerDelegate{
      
          func someAwesomeFunction(){
               var subjectText = “ OMG  a subject”
               var bodtText = “ YOLO”
      
               var picker = MFMailComposeViewController()
               picker.mailComposeDelegate = self
               picker.setSubject(subjectText)
               picker.setMessageBody(bodtText, isHTML: true)
      
               presentViewController(picker, animated: true, completion: nil)
          }
      

    【讨论】:

    • 谢谢,但想法是使用 UIActivityViewControl,它允许使用相同的控制器与邮件、消息、Facebook、Twitter 等共享。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-19
    • 1970-01-01
    • 2013-10-27
    • 1970-01-01
    • 2018-10-17
    • 1970-01-01
    • 2017-05-26
    相关资源
    最近更新 更多