2012-04-05 310 views
0

我正在嘗試在iPad上下載一個文件(存儲到應用程序文檔目錄中)openWithDefaultApplication。我安裝了PDFReaderLite,仍然openWithDefaultApplication不重新識別擴展名pdf。我能做些什麼來使PDFReaderLite成爲打開pdf的默認應用程序?使用iOs上的默認應用程序打開文件

預先感謝您

回答

1

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html#openWithDefaultApplication%28%29這表明openWithDefaultApplication是桌面功能。我不認爲默認應用程序的功能甚至存在於iOS ...

+0

是的,我讀過。沒有提示該功能在移動設備上不起作用。有關如何以另一種方式打開文件的想法? – Eugeny89 2012-04-05 11:08:26

+0

只有一種方法可以在iOS上執行此操作。您必須使用應用程序旨在打開的自定義URL並使用它調用應用程序。但是,您無法將此功能添加到現有的應用程序。它必須由作者添加。此鏈接有更多信息:http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html – borrrden 2012-04-05 11:51:52

0
UIButton *button = (UIButton *)sender; 
    NSURL *URL = [[NSBundle mainBundle] URLForResource:@"file_1" withExtension:@"pdf"]; 


    if (URL) { 
     // Initialize Document Interaction Controller 
     self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL]; 

     // Configure Document Interaction Controller 
     [self.documentInteractionController setDelegate:self]; 

     // Present Open In Menu 
     BOOL flag =[self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES]; 

     if (!flag) { 

      //[appDel showAlert:@"There is no supported app installed in your phone"]; 
      [self.documentInteractionController presentPreviewAnimated:YES]; 
     } 
相關問題