title: NSOpenPanel in sandbox allows illegal selections
body: <p>I'm working on a new version of my sandboxed app and have removed all the supported file types except for one.   When I run the app and select Open from the file menu I can only select and open files with the extension of my app's file type.  So far, so good.</p>
  
  <p>Now I have a method that combines the contents of two of my app documents.   With one document already open I call NSOpenPanel to get the second file.   In this case, however, I get the unexpected behavior that the NSOpenPanel allows me to select files that are not in my list of application file types.    However, they are file types that the previous version of the app can open.   This is strange since I deleted all the Document Types from my info.plist file except for the one.  </p>
  
  <p>Of course, when I select the "forbidden" file, I get nil back in the code below.  But I shouldn't have been allowed to select it in the first place. Any ideas why I'm getting this unexpected behavior?</p>
  
  <p>The code to open the 2nd file is below</p>
  
  <pre><code>NSOpenPanel *openPanel = [NSOpenPanel openPanel];
  [openPanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode)
   {
       if (returnCode == NSOKButton) {
           NSArray *filesToOpen = [openPanel URLs];
           NSURL *absoluteURL = [filesToOpen objectAtIndex:0];
           NSDocumentController *docController = [NSDocumentController sharedDocumentController];
           [docController openDocumentWithContentsOfURL:absoluteURL
                                                display:NO
                                      completionHandler:^(NSDocument *document,
                                                          BOOL documentWasAlreadyOpen,
                                                          NSError *error){
  
                                          // open document code here...
                                      }];
       }
   }
  </code></pre>
  
  <p>Update: my problem comes from not understanding the difference between CFBundleTypeName and the array of CFBundleTypeExtensions.  What I did is a bit confusing, but here goes.  </p>
  
  <p>In my new version I set my CFBundleTypeName to "X" and the CFBundleTypeExtensions to "Y".  </p>
  
  <p>In my old version I set my CFBundleTypeName to "Z", and the CFBundleTypeExtensions to "X".  </p>
  
  <p>When NSDocumentController created the NSOpenPanel I could only select files with extensions "Y", as expected.   But when I created the NSOpenPanel and gave it a fileType of "X", then I was able to select any file with extensions of "X" and "Y".   Two different behaviors from what I thought were the same configured NSOpenPanel.  What I don't know is how NSDocumentController configured the NSOpenPanel so I couldn't select files with the "X" extension.</p>