title: Cocoa/Obj-C - Open file when dragging it to application icon
body: <p>Currently there is a button on my app inteface which allow to open a file, here is my open code:</p>
  
  <p>In my app.h:</p>
  
  <pre><code>- (IBAction)selectFile:(id)sender;
  </code></pre>
  
  <p>In my app.m:</p>
  
  <pre><code>@synthesize window;
  
  - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
  
  }
  
  - (IBAction)selectFile:(id)sender {
  
      NSOpenPanel *openPanel  = [NSOpenPanel openPanel];
      NSArray *fileTypes = [NSArray arrayWithObjects:@"xml",nil];
  
      NSInteger result  = [openPanel runModalForDirectory:NSHomeDirectory() file:nil types:fileTypes ];
  
      if(result == NSOKButton){
  
          NSString * input =  [openPanel filename];
  </code></pre>
  
  <p>How can I edit my code to allow opening with the application-icon drag &amp; drop?
  <br>Note: I edited the .plist file and added a line for "xml" but it change anything, got an error when my file is dropped on the icon.
  <br>Note 2: I linked the "File -> Open..." to the selectFile: wich refer to my code
  <br>Note 3: My app isn't a document-based application</p>
  
  <p><br>Thanks for your help!
  <br>Miskia</p>