title: How to Convert NSURL to CFURLRef
body: <p>Apple gives sample code for Creating PDF document. But It uses CFURLRef</p>
  
  <p>NSPanel savepanel gives NSURL. </p>
  
  <p>I can't convert  NSURL to CFURLRef</p>
  
  <pre><code> path = CFStringCreateWithCString (NULL, filename, kCFStringEncodingUTF8);
  
   url = CFURLCreateWithFileSystemPath (NULL, path, kCFURLPOSIXPathStyle, 0);
   NSLog(@"CFURLRef %@",url);
  </code></pre>
  
  <p>output is</p>
  
  <p>2016-04-22 00:34:26.648 XXX Analysis[12242:813106] CFURLRef AnalysisReport.pdf -- file:///Users/xxxxxx/Library/Containers/com.xxxxxx.xxxnalysis/Data/</p>
  
  <p>convert code which i find</p>
  
  <pre><code>url = (__bridge CFURLRef)theFile;
  NSLog(@"NSURL %@",url);
  </code></pre>
  
  <p>output is </p>
  
  <p>2016-04-22 00:37:20.494 XXX Analysis[12325:816505] NSURL file:///Users/xxxxxx/Documents/xxxnalysis.pdf</p>
  
  <p>at the  end  PDF file is saved but Program crash when the NSPanel closed.</p>