2014-09-03 63 views
0

当我尝试使用UIDocumentInteractionController打开一个PDF文件时,所有安装的应用程序都可以处理PDF。如果我选择邮件应用程序,它会按预期工作,并将文件附加到新邮件,但其他每个应用程序都会失败。如果我尝试将文档从DropBox共享到PDF查看器,它可以工作。UIDocumentInteractionController只能与邮件应用程序共享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]; 
     } 
    } 
} 

我每次挑选那些邮件,我得到的设备控制台这些条目的应用程序。我不认为它们与问题有关,因为当我从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" } 

回答

0

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