Interact with Mail though UIDocumentInteractionController

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:


    //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];


You can do this through the following code

[self.documentInteractionController setName:@"My Email Subject"];

Need Your Help

Excel 2007 error "400 visual basic", when deleting worksheet

vba excel-2007 worksheet

I've read this, this, and this, and none of the "solutions" worked for me.

Take an `Iterator` instead of `Vec` when possible?

arrays vector iterator rust

When a function takes a series of values as a parameter, is it considered good style to accept an Iterator<T> instead of Vec<T>?