Open zuqiu123 opened 4 years ago
Hi @zuqiu123. I just tried a 50MB PDF file in this sample app, on an iPad. There were no crashes. PDF files can be extremely complex, where one 40MB file can be far more complicated internally than another 40MB file. I suggest working with other files and/or simplifying the file in question if feasible. Good luck.
The writing of the file locked the main thread as that occurred, so that should really be moved to a background thread. If you’re using this code for anything, I suggest changing:
self.pdfView?.document?.write(to: path)
to
DispatchQueue.global(qos: .background).async {
print("Writing starting now")
self.pdfView?.document?.write(to: path) //We don't really need to write this here - just demo'ing code
print("Writing complete")
}
in func savePDF().
Thank you for your reply. We use mobile phones. When the memory consumption of mobile phones like iPhone6 exceeds 300M, they will crash,I will try the method you provided to test under