【发布时间】:2016-03-19 09:05:46
【问题描述】:
在我的一项活动中,我使用 WebView 在屏幕上显示了一个 PDF,并尝试使用此代码保存此 PDF:
_pageSize = CGSizeMake(width, height);
NSString *newPDFName = [NSString stringWithFormat:@"%@", name];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSString *pdfPath = [documentsDirectory stringByAppendingPathComponent:newPDFName];
UIGraphicsBeginPDFContextToFile(pdfPath, CGRectZero, nil);
NSLog(@"path=%@",pdfPath);
当我在 iOS 模拟器(使用 Xcode)中运行此代码并显示路径并在文档文件夹中成功打开此 PDF 文件时,但当我在 iPhone 中运行此代码时,我得到了以下路径:
/var/mobile/Applications/0AF98361-C8DF-4C35-9E9F-EE48555185BC/Library/354746396.pdf
那么 PDF 文件存储在 iPhone 的什么位置?
【问题讨论】:
-
请解决我的问题