I see via sharing content from other apps that it is possible to set a different subject and body when using share sheet to share into the Gmail Mail app. I have implemented it and it works fine on the native mail app but not Gmail.
Going into Yelp and sharing a business then choosing gmail from the share sheet, I see that the subject and body are different. The subject contains the address of the business while the body contains the address + a link to the business on Yelp.
I have tried to replicate this logic with success on the native Mail app but not in the Gmail app.
I have tried the following:
Implementing UIActivityItemSource methods
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[self] applicationActivities:nil];
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {
return @"";
}
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
return @"body";
}
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType {
return @"subject";
}
Result
Apple Mail Subject set to "subject", Body set to "body"
Gmail Subject set to "body", Body set to "body"
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType
Is never called when sharing into the Gmail app.
I then try the more hack way of doing it
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[@"body"] applicationActivities:nil];
[activityViewController setValue:@"subject" forKey:@"subject"];
Result
Apple Mail Subject set to "subject", Body set to "body"
Gmail Subject set to "body", Body set to "body"
Any way to make Gmail Behave like Apple Mail?
Again, I have seen that other applications like Yelp and Safari have gotten the proper behavior out of the Gmail app through share sheet. Any advice would be appreciated, thanks.