UIActivityViewController Gmail Share subject and body going Same UIActivityViewController Gmail Share subject and body going Same ios ios

UIActivityViewController Gmail Share subject and body going Same


At the time of writing this, Google doesn't allow setting the subject of email. People have reported it as a bug multiple times, and it seems this feature is still not supported.

Looking at other Google-owned products, and trying to share some contents via Gmail, you will see that the Gmail shared activity doesn't have the subject (e.g Google Chrome), or it's the same as the email's body (Google Translator), while if you share them to the normal app it appears that some of them have a subject. So even Google products have the same behaviour.

If you use a breakpoint inside the subjectForActivityType function you will realise that the Gmail activity won't hit the breakpoint while default mail and other activities will attempt to read the subject.

@implementation EmailItemProvider- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {    return _body;}- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {    return _body;}- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType {    return _subject;}