QLPreviewController crashing when tapping share button, internal consistency nib bundle error
Asked Answered
T

0

2

I'm presenting a QLPreviewController modally. Everything works-- it pops up, shows the preview item and everything. However, once the share button is tapped, the app crashes on the device and in the simulator with this:

2013-05-03 20:10:53.563 appname[16860:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle <{{app_path}}> (loaded)' with name '_UIDocumentActivityViewController''

Here is the relevant code:

#pragma mark HVSchedulesDelegate

- (void)schedulePDFReceived {
    QLPreviewController *previewController = [[QLPreviewController alloc] init];
    [previewController setDataSource:self];

    [self presentViewController:previewController animated:YES completion:nil];
}

#pragma mark QLPreviewControllerDataSource

- (NSInteger) numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
    return 1;
}

- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
    return [NSURL fileURLWithPath:self.schedulesProxy.pdfPath];
}
Tien answered 4/5, 2013 at 1:22 Comment(6)
did you try in device?Giannini
File a bug, attach a sample app. That shouldn't happen.Gaye
I tested this in Apple's DocInteraction project, fetching a file the same way then displaying it. It WORKS. Both targets are 6.1.. what could possibly be causing this?Unhandy
I get the following in the debugger (after displaying the document): 2013-07-03 13:56:51.034 PaletteJigsaw[8461:907] Cannot find preview item for loaded proxy: <QLPreviewItemProxy: 0x1c581cb0> - file://localhost/var/mobile/Applications/0E278466-AEBA-4965-B5E1-23A9056DACE5/PaletteJigsaw.app/Documentation.pdf 2013-07-03 14:06:35.108 PaletteJigsaw[8461:907] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-2380.17/UIDocumentInteractionController.m:960Forefront
Just a thought - could it have something to do with rights to the directory containing the file? Does it need to be in a public directory?Forefront
Never mind. My problem apparently stemmed from using [[NSURL alloc]initWithString:filePath] instead of [NSURL fileURLWithPath:filePath];Forefront

© 2022 - 2024 — McMap. All rights reserved.