title: Getting URL From beginSheetModalForWindow:
body: <p>I'm using an OpenPanel to get a file path URL. This works:</p>
  
  <pre><code>[oPanel beginSheetModalForWindow:theWindow completionHandler:^(NSInteger returnCode)
  {
   NSURL *pathToFile = nil;
  
   if (returnCode == NSOKButton)
       pathToFile = [[oPanel URLs] objectAtIndex:0];
  }];
  </code></pre>
  
  <p>This doesn't, resulting in an 'assignment of read-only variable' error:</p>
  
  <pre><code>NSURL *pathToFile = nil;
  [oPanel beginSheetModalForWindow:theWindow completionHandler:^(NSInteger returnCode)
  {
   if (returnCode == NSOKButton)
       pathToFile = [[oPanel URLs] objectAtIndex:0];
  }];
  return pathToFile;
  </code></pre>
  
  <p>In general, any attempt to extract pathToFile from the context of oPanel has failed. This isn't such a big deal for small situations, but as my code grows, I'm forced to stuff everything -- XML parsing, core data, etc -- inside an inappropriate region. What can I do to extract pathToFile?</p>
  
  <p>Thanks.</p>