UIDocumentInteractionController只能与Mail app共享pdf

时间:2014-09-03 10:54:53

标签: ios pdf uidocumentinteraction

当我尝试使用UIDocumentInteractionController打开pdf文件时,所有已安装的可以处理PDF的应用程序都会显示出来。如果我选择邮件应用程序,它按预期工作,文件将附加到新邮件,但每个其他应用程序都失败。如果我尝试将文档从DropBox共享到PDF查看器,它可以工作。

我使用的代码:

- (void)presentOptionsForFilename:(NSString *)path {
    NSURL *url = [NSURL fileURLWithPath:path];

    if (url) {
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL: url];
        if (self.documentInteractionController != nil) {
            self.documentInteractionController.delegate = self;
            [self.documentInteractionController presentOptionsMenuFromRect:CGRectZero
                                                                    inView:self.view
                                                                  animated:YES];
        }
    }
}

每次我选择不是Mail的应用程序时,我都会在设备控制台中获取这些条目。我不知道他们是否与这个问题有关,因为当我从DropBox打开pdf时,他们也会到达那里。

Sep  3 12:37:13 <devicename>-iPad com.apple.mdt[262] <Notice>: Copy /var/mobile/Applications/80BC2CCF-E49A-4800-8005-30DD304701CF/tmp/DBExportDir/Getting Started.pdf -> /private/var/mobile/Applications/3374FC4A-D57F-476E-ABC9-94A2484343D6/Documents/Inbox
Sep  3 12:37:14 <devicename>-iPad wirelessproxd[36] <Notice>: (Note ) stopped advertising for sharingd
Sep  3 12:37:14 <devicename>-iPad wirelessproxd[36] <Notice>: (Error) error event: (<OS_xpc_error: <error: 0x192c3bdc8> { count = 1, contents =
    "XPCErrorDescription" => <string: 0x192c3c0d0> { length = 18, contents = "Connection invalid" }

1 个答案:

答案 0 :(得分:0)

问题是路径是另一个文件的符号链接。将其更改为硬链接后,它就能正常工作。