UIActivityViewController showing body text in subject at gmail and yahoo mail not showing subject swift

Hi All,

Issue on share the mail client using gmail and yahoo mail. How to solve this issue, please find the below comment and any idea to solve this issues.


  • Working perfect in mail client but not working in gmail and yahoo mail.
  • Gmail - Shows body as same in subject - issue

Yahoo - Not showing the subject - issue

Mail client - Correct format. Need like this format in google and yahoo.

  • I tried many ways but not get any solution. Someone helps how to solve this issue.
  • Please find the above screenshots gmail,yahoo and mail client.
  • Kindly find the below code and how can i solve this issues.


let objectsToShare:Any?

if let myWebsite = URL(string: webServiceMailUrl + name)

{

objectsToShare = [content,myWebsite] as [Any]

} else

{

objectsToShare = [content] as [Any]

}

let activityVC = UIActivityViewController(activityItems: objectsToShare as! [Any],applicationActivities: nil)

activityVC.setValue(title, forKey: "Subject")

if UI_USER_INTERFACE_IDIOM() == .pad

{

activityVC.popoverPresentationController?.sourceView = view

activityVC.popoverPresentationController?.sourceRect = CGRect(x: CGFloat(view.bounds.size.width / 2), y: CGFloat(view.bounds.size.height / 4), width: CGFloat(0), height: CGFloat(0))

}

activityVC.excludedActivityTypes = [.print, .postToWeibo, .copyToPasteboard, .addToReadingList, .postToVimeo]

present(activityVC, animated: true, completion: nil)

I'm also seeing this issue. I am wanting to send HTML to the body of the email and of course that comes in as HTML source code. I also worked on sending the appropriate UTI type, sending the body as NSData in an UIActivityItemProvider. I just ended up looking at the activityType and if it contains "gmail", I send different things. The real bummer is that Gmail for unknown reason, doesn't read from activityViewController:subjectForActivityType: for the subject, but rather duplicates the body. Dumb. But I've come to expect this behavior from Google especially when you want them to work with Apple products. They just seem to let bugs in there and don't prioritize them. Why? Well because they don't want people on iOS.


So I just return the subject now for Gmail in activityViewController:itemForActivityType: because Gmail is dumb.

UIActivityViewController showing body text in subject at gmail and yahoo mail not showing subject swift
 
 
Q