views:

50

answers:

1

I get an EXC_BAD_ACCESS on this code:

    NSURL *pdfURL = [NSURL URLWithString:path];
  pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
  CFRelease(pdfURL);

'path' is just an NSString path the the file I am loading from the documents directory. I have chanced to ensure the path is correct. I am also running on the simulator but I don't see why this should make a difference in this situation.

Any ideas why the crash is occurring?

Thanks

+2  A: 

Don't release pdfURL. URLWithString: returns an autoreleased object.

Altealice