你好,我是iOS的初學者在我的一個活動中,我想問.....我在屏幕上使用WebView ......顯示PDF並保存這個PDF,然後寫這個的代碼類型........如何在iPhone中找到PDF文件
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex:0];
NSString *pdfFilePath =[documentsDir stringByAppendingPathComponent:@"myPDF.pdf"];// your yourPdfFile file here
NSLog(@"pdf file %@",pdfFilePath);
NSURL *url = [NSURL fileURLWithPath:pdfFilePath];
UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:url];
docController.delegate = self;
[docController presentOpenInMenuFromRect:CGRextZero inView:self.view animated:YES];
當我們運行模擬器此代碼(使用Xcode的),那麼顯示的路徑和我的文檔文件夾中順利地拿到了這個PDF文件....... 但是,當我們運行iPhone設備這個代碼,然後我得到了這個類型的路徑......
/var/mobile/Applications/D33A80AA-C0AD-4211-ADE3-4906372CDA40/Documents/myPDF.pdf
所以我不知道哪裏是我在iPhone設備PDF文件第二如何得到這個PDF和開放.....當我想......
我們不能確定像模擬裝置的文檔文件夾中。我們只在您發佈時纔會獲得路徑 –