How to manage memory within a QLPreviewController

2019-08-09 23:32发布

We are currently using a QLPreviewController to load a collection of PDFs. The size of the collection can range from 16, 95, or even 1600+ PDFs. Due to the data source of the PreviewController containing multiple items we now have the ability to swipe left or right within the preview modal and load the next PDF in the list.

This functionality has introduced an issue where a gray screen appears within the controller at various locations within the collection. It may occur on the 3rd item, 50th, or 161st item; this error is very inconsistent and difficult to reproduce.

Apple's Gray Screen of Death

When the gray screen appears in the modal the ability to swipe left or right is no longer available. After dismissing the modal and re-selecting the PDF from the table source, it loads without issue. This experience reinforces our theory that this gray screen appears due to memory management issues.

What is the proper way to manage memory within a QLPreviewController regardless of size of the data source? Are there code examples which demonstrate how to use a QLPreviewController with multiple items in its data source?

0条回答
登录 后发表回答