Display pdf from files folder(outside of sandbox) in iOS

I am trying to display the pdf that I had earlier saved in files folder. I am trying to create a url of the file and display it using pdfKit but the url is always nil. I am trying as following:

let url = URL(fileURLWithPath: "file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~uvita/Documents/Symptom%20Checker_E07DB307-667A-4BFA-A4D7-AE6F0F2AE3F4.pdf")
        guard let pdf = PDFDocument(url: url) else { return nil }

The pdf variable is coming nil but url is correct.

  • Use FileManager

    – 

  • Use UIFilePickerViewacontroller

    – 




  • @Paulw11 You probably meant UIDocumentPickerViewController

    – 

Leave a Comment