0

I use QLPreviewController is very simple way: I have NSMutableArray<NSURL*> *_files;

I launch it

QLPreviewController* ql = [QLPreviewController new];
ql.dataSource = self;
ql.delegate = self;
[self.navigationController pushViewController:ql animated:TRUE ];

And I provide files

 -(NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
    return _files.count;
}

-(id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
    return _files[index];
}

It works for any doc, docx, xls, xlsx, and some PDFs. But several PDF are not displayed! It simply shows "Loading" and nothing more. I click on "share" button, choose "copy to actobat reader" and it opens in AR perfectly!

No errors in logs. What can I do?

user996142
  • 2,753
  • 3
  • 29
  • 48

1 Answers1

0

Looks like it does not work if you have ./ in path. It works for docx, but not for pdf. Following url works:

[[NSBundle mainBundle] URLForResource:@"./ok" withExtension:@"docx"];

Following works as well

[[NSBundle mainBundle] URLForResource:@"file" withExtension:@"pdf"];

But this DOES NOT

[[NSBundle mainBundle] URLForResource:@"./file" withExtension:@"pdf"];
user996142
  • 2,753
  • 3
  • 29
  • 48