你好,我是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和开放.....当我想......
我们不能确定像模拟装置的文档文件夹中。我们只在您发布时才会获得路径 –