0

我正在使用 UIWebView 在我的应用程序中显示 PDF。我正在使用它从支持文件中加载 PDF 并显示它。

NSString *urlAddress = [[NSString alloc] init];

urlAddress = [[NSBundle mainBundle] pathForResource:@"MyFile" ofType:@"pdf"];

NSURL *url = [NSURL fileURLWithPath:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[self.pdfWebView loadRequest:requestObj];

当我运行应用程序时, UIWebView 是空白的。

4

1 回答 1

0

It seems your MyFile.pdf is not included in the bundle. If you run it on the simulator you can browse to your simulators App and right click show content. Check with [[NSFileManager defaultManager] fileExistsAtPath:url].

于 2013-07-25T21:38:22.117 回答