title: NSApplicationDelegate application:openFile. Never reaches to openFile: function
body: <p>I want to open a file dropping it on the app icon.
  When I do it my app is opened so the file extension is well defined and related to my app.
  But the <code>application:openFile:</code> function never is called. so I can't open the file dropped in my app.
  I traced <code>openFile:</code> but never goes.</p>
  
  <p>All the answers that I found are just to add in the delegate the <code>openFile:</code> and that's all but not in my case.</p>
  
  <p>Any help will be very appreciate it. Thanks a lot in advance.</p>
  
  <p>This is my environment.</p>
  
  <p>The plist has got the extension of files to be opened. My app is opened when I drop the files.</p>
  
  <p>I initialize my delegate at the beggining of the app,</p>
  
  <pre><code>   mydelegate = [[MyController alloc] init];
  </code></pre>
  
  <p>And in the delegate,</p>
  
  <p>in the include,</p>
  
  <pre><code>@interface MyController : NSObject &lt;NSApplicationDelegate&gt; {
  
  @private
  
       NSWindow *window;
  }
  
  @property (assign) IBOutlet NSWindow *window;
  
  -(id)   init;
  
  -(BOOL) application: (NSApplication*)sharedApplication openFile:(NSString*) fileName;
  
  @end
  </code></pre>
  
  <p>And in the .m file,</p>
  
  <pre><code>@implementation MyController
  
  @synthesize window;
  
  
  - (id)init{
  
      self = [super init];
      if (self) {
          [[NSNotificationCenter defaultCenter] addObserver:self
            selector:@selector(applicationWillFinishLaunching:)
            name:NSApplicationWillFinishLaunchingNotification object:nil];
      }
      return self;
  }
  
  - (void) applicationWillFinishLaunching:(NSNotification *)aNotification{
  
      NSLog(@"applicationWillFinishLaunching");
  }
  
  -(BOOL) application: (NSApplication*)sharedApplication openFile:(NSString*) fileName {
  
      NSLog(@"openFile=%@", fileName);
      return YES;
  }
  
  @end
  </code></pre>