The “supporting files” folder of my app contains a document named test.pdf.
Trying to view the pdf file with the following code in ViewDidLoad displays an empty UIWebView:
NSString *testPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"];
NSURL *testURL = [NSURL URLWithString:testPath];
NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL];
UIWebView *documentWebView;
documentWebView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 24, 300, 400)];
[documentWebView loadRequest:testRequest];
[self.view addSubview:documentWebView];
Can anyone tell me why the PDF isn’t displayed in the web view? Thanks.
This line:
needs to be: