我正在尝试使用UIActivityViewController仅限Outlook...我已经成功让UIActivityViewController工作,如下所示:
//Define HTML String
var htmlString = ""
//Add the headings to HTML String table
htmlString += "<table border = '1' cellspacing='0' align = 'center'><tr><th>Job #</th><th>Task</th><th>Date</th></tr>"
//For each item in punch list data array
for i in 0..<punchListData.count {
//If the item is selected
if punchListData[i].cellSelected {
//Add data to the HTML String
htmlString += "<tr><td>" + jobList[i % jobList.count] + "</td><td align = 'center'>" + taskData[i / jobList.count] + "</td><td>" + (punchListData[i].stringData)! + "</td></tr>"
}
}
//Close the HTML table in the HTML String
htmlString += "</table><h5>Please contact me if you have any questions <br /> Thank you.</h5>"
let activityViewController = UIActivityViewController(activityItems : [htmlString], applicationActivities: nil)
activityViewController.setValue("Schedule for Community", forKey: "Subject")
activityViewController.popoverPresentationController?.barButtonItem = self.shareButton
self.present(activityViewController, animated: true, completion: nil)
但是我有几个问题:
邮件主题无法工作,我进行了一些研究,发现 setValue 对于 Outlook 无效,并且第一行可以是邮件主题,但我不知道如何实现。
有没有办法除了 Outlook 之外排除所有活动?
以前我只是使用 MFMailComposeViewController 来撰写电子邮件,是否有方法可以在没有 UIActivityViewController 的情况下使用 Outlook 进行操作?
谢谢,
MFMailComposeViewController
是为本地iOS Mail.app设计的,不是吗?此外,UIActivityViewController
默认涉及任何可以与该活动交互的人。如果您想要非常具体地针对Outlook,请在接近方法中特别指定,例如调用其深度链接或使用它们的框架(如果有)。 - Mojtaba Hosseini