I've already attemped a WKWebView with no luck. Now I'm attempting to use QLPreviewController.
I've created a UIViewController and subclassed it under QLPreviewController.
In my viewDidLoad I set the delegate and data source:
self.dataSource = self;
self.delegate = self;
self.currentPreviewItemIndex = 0;
I then have the following two methods to get the number of items in the view controller and the file path:
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
return 1;
}
- (id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"BOR" ofType:@"pdf"];
NSURL *fileURL = [[NSURL alloc] initWithString:pdfPath];
return fileURL;
}
When I navigate to my view controller, The view is gray and displays the following text:
"No file to preview"
What am I doing wrong?