I'm sharing a PDF to other apps through the UIDocumentInteractionController
. Prior to adding this functionality, I had a custom 'send to email' button using the MFMailComposeViewController
- yet now there's also a Mail button in my UIDocumentInteractionController
, which I'd like to make use of, to avoid having duplicate buttons.
My issue is, through the old mail controller, I used to set a subject, and content text, whereas if I use the UIDocumentInteractionController
- I only get a blank email with the PDF attachment. Does anyone know a way I could work round this and get my custom subject and content when using the UIDocumentInteractionController
?
I couldn't find anything obvious in the documentation, and clearly I can't meddle with the Mail app to make it communicate with my app - but wondered if anyone else had encountered the problem, and sussed out a 'back-door' solution.
Below is the code for how I'm currently creating and initalising my UIDocumentInteractionController
:
-(void)openDocumentIn:(NSString*)filepath
{
//NSString * filePath = [[NSBundle mainBundle]
pathForResource:filePath ofType:@"pdf"];
documentController = [UIDocumentInteractionController
interactionControllerWithURL:[NSURL fileURLWithPath:filepath]];
documentController.delegate = self;
documentController.UTI = @"com.adobe.pdf";
[documentController presentOptionsMenuFromBarButtonItem:
[self.imageViewController exportQuote] animated:YES];
}