We have an app that contains a bunch of PDFs in its bundle. When the user taps a button or selects a table cell, we want to display the corresponding PDF in a UIDocumentInteractionController.
This works great on my machine, and on most of the test machines, but I have one user who sees no preview on his iPhone. He sent me a screen shot; the controller has pushed its view onto the navigation stack, and has a working "Action" menu in the nav bar, next to the correct file name. But the big space where the PDF itself should be shown is just a dark gray.
That's on a new iPhone running 6.0.1; on his iPad, also running 6.0.1, it works fine; and on my iPhone 4S running 5.0.1, it works fine. "Works fine" means that it pushes exactly the same surrounding details, including the file name and action menu, but instead of a big gray space, there is a working preview of the PDF.
My view controller hierarchy consists of a tab controller, and within each tab, a navigation controller. The same problem exists both from a table view that's several levels deep in the navigation stack, or from an HTML view that's at the top level of the nav stack. The code to present the controller looks like this:
self.DIC = [UIDocumentInteractionController interactionControllerWithURL:url];
self.DIC.delegate = self;
[self.DIC presentPreviewAnimated:YES];
and the only delegate method implemented is:
- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
if (curTabViewController) return curTabViewController;
return tabCtrl;
}
This would be returning the current navigation view controller, which I set in tabBarController:didSelectViewController. I can tell that that's working, because the DIC has pushed its view onto the navigation stack, rather than popped up modally.
So. Any idea why UIDocumentInteractionController would be failing to draw a preview on some devices but not others?
UPDATE: I've managed to get this device set up for debugging. The only clue that appears in the log file is this error:
Cannot find preview item for loaded proxy: <QLPreviewItemProxy: 0x1fd67820> -
file://localhost/var/mobile/Applications/22DDE4EB-6FB6-4364-87D6-E3680E1E1A9B
/agilentJAL.app/BuiltInFiles/help/Getting_Started.pdf
I've searched the interwebs, and found this question, but it doesn't seem to apply in my case. I've double-checked the path and it appears correct (and the DIC menu can successfully email the document, open it in DropBox, etc.) Any idea what else could cause this error?