In my app I have got a AMPathPopUpButton which returns the location of a file in a string(format : ~/Desktop/file.pdf). I would like to make a CGPDFDocument of this file. But my application seems unable to access the file because it is outside my app's bundle. So the CGPDFDocument is always nil. How would I use this file path string to create a working CGPDFDocument? Thanks for helping me!
some of my code: (MyName is my actual name of course)(the CFUrl is for example : file:///Users/MyName/Desktop/file.pdf)
var document: CGPDFDocumentRef!
filepath = String("/Users/MyName" + String(filepath.characters.dropFirst()))
let url = NSURL.fileURLWithPath(filepath)
let CFUrl = url as CFURL
document = CGPDFDocumentCreateWithURL(CFUrl)