CGPDFDocumentRef issue

Discussion in 'Mac Programming' started by Fuzzball27, Jan 3, 2013.

  1. macrumors newbie

    Joined:
    Aug 8, 2011
    #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!
     
  2. thread starter macrumors newbie

    Joined:
    Aug 8, 2011
    #2
    Got it

    I figured it out:
    I should have been using "CFURLCreateWithFileSystemPath" not "CFURLCreateWithString"
     

Share This Page