blank QLPreviewController in iOS application
Asked Answered
B

1

8

I am trying to display a file using QLPreviewController. The QL view displays correctly (is pushed on top of my Navigation Controller) but the content is blank. However, no errors are displayed and application doesn't crash. Checks on existence of file return true. (A proof is that if I use [self.docInteractionController presentPreviewAnimated:YES]; where docInteractionController is a UIDocumentInteractionController the file is correctly shown).

The code is taken directly from Apple sample code DocInteraction.

previewController.dataSource = self;
previewController.delegate = self;
// start previewing the document at the current section index
previewController.currentPreviewItemIndex = 0; //I want the first (and only) document
[[self navigationController] pushViewController:previewController animated:YES];
[previewController release];

The current view is a QLPreviewControllerDataSource, QLPreviewControllerDelegate,, and the delegate methods are as follow:

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

- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:    (NSInteger)index
{
return [self.documentURLs objectAtIndex:index];
}

documentURLs is a NSArray that contains the fileURLs of the documents. The same fileURL passed to the UIDocumentInteractionController displays correctly. I don't necessarily have to use QuickLook, I may just rely on UIDocumentInteractionController, however the fact that it's not working is really annoying.

Thank you in advance

Giovanni

Bevbevan answered 4/11, 2011 at 13:8 Comment(3)
18 months later with no answers. Drat. I have the same issue, but only on certain devices. Can't even isolate to a particular version of iOS. Has no one been able to isolate this? Is it just a bug in the QLPreviewController code?Athletics
#16370176Pothook
same problem here. i got problem " Unsupported preview item type in -previewItemViewControllerClassWithStyle:" when preview pdf file local urlLanai
I
0

Make a sample that demoes the issue. If you find that it still occurs on iOS 7, pls file a bug report.

I reported a bug on this class (pass nil URL to get loading indicator) and it got fixed within 2 weeks.

Indusium answered 21/8, 2013 at 5:24 Comment(1)
Thank you. I will try iOS7 first and eventually file a bug reportBevbevan

© 2022 - 2024 — McMap. All rights reserved.