Instead of loading a PDF from the resources folder I would like to load it from the documents directory. I have been trying to do this for days but the CGPDFDocumentRef keeps
You probably don't have a PDF file at that path. The “Create” in CGPDFDocumentCreateWithURL
refers to the CGPDFDocument object; it will not create a document file at that URL. You can only create a CGPDFDocument object for a PDF file that already exists.
Also, as I mentioned on your other question, I don't see why you're trying to delete “localhost/” from the path. It's unlikely to exist there in the first place (it's more likely to only appear in the URL), and if it ever does appear there, it should appear there, and stripping it out will make the path wrong.