Pretty much all the apps I use on a regular basis implement this 'seemly simple' scenario, yet I can't replicate this in my own Cocoa application. Please consider these steps:
- The application is not running
- You drop a file, or a selection of files onto the app's icon.
- The app runs and performs some actions on the dropped files.
- Maybe it opens them, maybe not, but stuff happens.
When I try googling the answer, some of them even here on stackoverflow point me towards the NSApplicationDelegate's application:openFiles: method. The explanation on how to get from Apple events to the delegate is here.
With the proper UTIs in place (**), this works like a charm when the application is already running. However, since I'm trying to make a 'droplet' style application, I want it to also work when the app is not yet running.
And in this last scenario, the application:openFiles: method is not called. Right now I have only a simple NSLog() call in there, and it doesn't show (I'm looking at the Console.app, since it's kinda hard simulating a dropped file on build in XCode).
Can someone tell me where to look, what to do, what to change?
Cheers, Eric-Paul.