UIActivityViewController not working for Outlook

Purpose of an object sharing protection, redefinition

func activityViewController(activityViewController: UIActivityViewController, subjectForActivityType activityType: String?) -> String { return "mySubject" } 

does not work for Outlook application when sharing. this method is not called for Outlook, it works for other applications such as mail, gmail, etc.

It was found that some applications, such as Yelp, Apple maps, Google Maps, can install the theme in Outlook. How to achieve this?

+6
source share
2 answers

I think I understood how this was done to work in these applications. I observed the same behavior in my own application where func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) โ†’ String not called when selecting an Outlook application. However, I noticed that the CNN application, as an example, correctly creates a subject line.

The answer seems to be to make the first line of the body text the way you want the subject to be. I had a resource to which I attached a URL, and so the subject inserted a URL that I do not need. However, when I made the right subject, the first line of the body of the letter, it correctly filled the subject line in Outlook.

So this is not ideal, and, of course, the corresponding protocol function should be called, but it seems that this is how others circumvented something that we could not otherwise fix for Apple or Microsoft.

+1
source

Have you tried this ?,

 var avc = UIActivityViewController(activityItems: activityItems, applicationActivities: nil) avc.setValue("Subject for Email", forKey: "subject") 
0
source

Source: https://habr.com/ru/post/1236706/


All Articles