by jules » Thu Oct 21, 2010 2:38 pm
Yes, sorry - you're right about it getting called for the first instance too.
It looks like what you're seeing is because during initialisation, the OS thinks (quite reasonably) that the app hasn't finished launching yet, so it doesn't send an openFile: message..
I don't think this is a bug or anything that needs fixing, though - it actually makes a lot of sense to avoid opening documents until the app has finished initialising. If for example during start-up you need to show a modal dialog or something, then you don't want the OS to start making it open documents while it's busy interacting with the user.
A splash screen shouldn't really be shown modally anyway! And any kind of modal loop during the initialisation stage feels a bit dodgy to me anyway. If you want to e.g. delay your main window appearing for a few seconds to make sure the users see your splash, then you should use a timer to reveal the window later, rather than blocking the initialisation process and waiting for it.
Alternatively, you could move all your initialisation into an asynchronous callback, running it after the main initialise() method has returned. By that time, the app will be in its "launched" state and the OS will presumably think it's ok to ask it to open documents.