UIDocumentInteractionController presentOptionsMenuFromBarButtonItem不打开app

时间:2015-10-15 19:07:14

标签: ios uidocumentinteraction open-with

我使用UIDocumentInteractionController presentOptionsMenuFromBarButtonItem在Adobe Reader应用程序中打开PDF,使用Mail发送并打印它。邮件和打印工作正常,但我无法打开任何其他应用程序。我尝试了presentOpenInMenuFromBarButtonItem和UIActivityViewController,但它们都没有我做的所有。

我尝试使用documentInteractionController打开Adobe Reader:willBeginSendingToApplication:delegate但我无法找到如何将pdf传递给应用程序。有可能吗?

如果没有,是否有另一种方法可以在Adobe Reader应用程序中打开PDF,使用Mail发送并打印它?

由于

1 个答案:

答案 0 :(得分:2)

通常这就是我的方式:

   NSURL *documentsDirectoryPath = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]];

    NSURL *URL =[documentsDirectoryPath URLByAppendingPathComponent:@"your pdf"];

    UIButton *button = (UIButton *)nil;
    self.documentInteractionController.delegate=self;
    if (URL) {
        // Initialize Document Interaction Controller
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
        // Configure Document Interaction Controller
        [self.documentInteractionController setDelegate:self];
        //preview
       [self.documentInteractionController presentPreviewAnimated:YES];
        // Present Open In Menu
        [self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES];

    }