views:

106

answers:

0

Possible Duplicate:
Load PDF from documents directory - iPhone

I am trying to load a file from the documents directory. Here is my code:

// Get Documents Directory
    NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *documentsDirectoryPath = [searchPaths objectAtIndex:0]; 
    NSString *path = [NSString stringWithFormat:@"%@/%@.pdf", documentsDirectoryPath, appDelegate.issueToLoad];
    NSLog(@"PATH: %@", path);

    //Display PDF
    NSURL *pdfURL = [NSURL fileURLWithPath:path];
    NSLog(@"URL: %@", pdfURL);
    pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);

However the file is not loading and I believe it is because when the path is converted to an NSURL it automatically adds percent escapes. What is the best solution to this issue?

Thanks