通过UIDocumentInteractionController与Mail交互

Chr*_*ris 8 cocoa-touch ios uidocumentinteraction ios7

我正在通过它与其他应用共享PDF UIDocumentInteractionController.在添加此功能之前,我有一个自定义的"发送到电子邮件"按钮使用MFMailComposeViewController- 但现在我还有一个邮件按钮UIDocumentInteractionController,我想使用它,以避免重复按钮.

我的问题是,通过旧邮件控制器,我曾经设置主题和内容文本,而如果我使用UIDocumentInteractionController- 我只收到一封带有PDF附件的空白电子邮件.有没有人知道我可以解决这个问题,并在使用时获取我的自定义主题和内容UIDocumentInteractionController

我在文档中找不到任何明显的东西,显然我不能干涉Mail应用程序以使其与我的应用程序通信 - 但是想知道是否有其他人遇到过这个问题,并且怀疑是"后门"解决方案.

以下是我目前正在创建和初始化我的代码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];
}
Run Code Online (Sandbox Code Playgroud)

Wil*_*ill 0

您可以通过以下代码来完成此操作

[self.documentInteractionController setName:@"My Email Subject"];
Run Code Online (Sandbox Code Playgroud)

  • 问题是关于设置邮件编辑器的属性。setName:将设置导航栏中 UIDocumentInteractionController 的标题,而不是邮件的主题。 (2认同)