Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fuzzball27

macrumors member
Original poster
Aug 8, 2011
30
1
I'm missing something obvious here, but I can't remember what... :eek:

Can someone explain to me why when I log "url" it comes out as expected, and when I create "document" I get error code -15?

Code:
NSString *filePathString = [filePath stringValue];
    CFStringRef URLString = (CFStringRef)CFBridgingRetain(filePathString);
    CFStringRef URLStringEscaped = CFURLCreateStringByAddingPercentEscapes(NULL, URLString, NULL, NULL, kCFStringEncodingUTF8);
    CFURLRef url = CFURLCreateWithString(kCFAllocatorDefault, URLStringEscaped, NULL);
    NSLog(@"%@", url);
    CGPDFDocumentRef document = CGPDFDocumentCreateWithURL(url);

Thanks!
 

Fuzzball27

macrumors member
Original poster
Aug 8, 2011
30
1
Got it

I figured it out:
I should have been using "CFURLCreateWithFileSystemPath" not "CFURLCreateWithString"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.