iOS - 当 QLPreviewController 关闭时获取文档的 URL

iOS - get document's URL when QLPreviewController is closed

我有预览 PDF 文件的代码:

QLPreviewController *previewController=[[QLPreviewController alloc]init];
previewController.delegate=self;
previewController.dataSource=self;
[self presentModalViewController:previewController animated:YES];

现在,当我关闭 QLPreviewControllerpreviewController 时调用此方法:

- (void)previewControllerDidDismiss:(QLPreviewController *)controller {
    NSLog(@"You closed the document");
}

现在,当我调用此方法时,如何 return 文档或 Pdf URL:

- (void)previewControllerDidDismiss:(QLPreviewController *)controller {
        //here I need to be able to get the PDF's URL or Data when is closed
    }

有人可以帮忙吗?

非常感谢。

检查文档 here。还有另一种方法,它响应用户操作并且 returns 需要 URL:

- (BOOL)previewController:(QLPreviewController *)controller
            shouldOpenURL:(NSURL *)url
           forPreviewItem:(id<QLPreviewItem>)item