I'm sending an email, with a PDF attachment, while using UIDocumentInteractionController, like this:
I start by showing the PDF file
-(void)showPDFFile
{
NSURL *url = [NSURL fileURLWithPath:_filePath];
if (url) {
_documentInteractionController =
[UIDocumentInteractionController interactionControllerWithURL:url];
[_documentInteractionController setDelegate: self];
[_documentInteractionController presentPreviewAnimated:YES];
}
}
- (UIDocumentInteractionController *)setupControllerWithURL:(NSURL *)fileURL
usingDelegate:(id <UIDocumentInteractionControllerDelegate>)interactionDelegate {
UIDocumentInteractionController *interactionController =
[UIDocumentInteractionController interactionControllerWithURL: fileURL];
[interactionController setDelegate: interactionDelegate];
return interactionController;
}
When the PDF file is shown, the user clicks the "Export" option and the iOS's "Open with" view appears.
Clicking the email now opens a View Controller ready to send an email.
How would I set the To: CC/BCC and Subject fields programatically?
Thank you!
You can assign the mail's subject by using the UIDocumentInteractionController
name
property:
_documentInteractionController.name = @"My custom mail subject";
Unfortunately this is the only attribute I've figured out that can be configured via UIDocumentInteractionController
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With