I'm using uiactivityviewcontroller for showing sharing option. Everything working except when user selects the Gmail sharing option. If user chooses email then it shows the content properly. But if i choose gmail then nothing is displayed in the body text.
Here is the code:
NSString *str = [NSString stringWithFormat:@"%@",@"Check the application"];
NSArray* dataToShare = @[str]; // ...or whatever pieces of data you want to share.
UIActivityViewController* activityViewController = [[UIActivityViewController alloc] initWithActivityItems:dataToShare applicationActivities:nil];
[activityViewController setValue:@"Check it out" forKey:@"subject"];
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
activityViewController.popoverPresentationController.sourceView = self.view;
activityViewController.popoverPresentationController.sourceRect = CGRectMake(0,self.view.frame.size.height, self.view.frame.size.width, 400);
}
[self presentViewController:activityViewController animated:YES completion:nil];
[activityViewController setCompletionHandler:^(NSString *activityType, BOOL completed) {
if(completed){
}
}];
}
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType{
return @"Check it out";
}