QLPreviewController crashing when tapping share bu

2019-07-08 23:51发布

问题:

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];
}