I'm not sure why it isn't being called (spelled wrong?), but if you want to put 
up a dialog box at this time, you won't be able to.

A dialog box needs a running run loop to handle its events, and the run loop 
isn't running at this time. What will happen is that the dialog will come up, 
then the method returns, the app continues launching, opens all its windows, 
then starts to handle events for the dialog. The upshot is that the normal 
windows will open behind the dialog box, probably not what you intended.

Getting this right is a real pain - despite asking via Radar for a standard 
supported way to show a modal window during app launch, this has not been 
added. In Lion it's even more painful with all the new document resuming stuff 
that goes on.

Essentially, you need to determine if you need to show the dialog, and if you 
plan to, then suppress all the normal window opening (the app delegate has 
methods to allow/disallow it). When the app finishing launching, show the 
dialog. Afterwards, you'll need to open a new document or somehow trigger the 
opening of all the ones the user expected, which means you will have had to 
capture enough information during launch to determine what those would have 
been. It's a royal pain.

--Graham





On 30/09/2011, at 9:48 AM, koko wrote:

> I have implemented applicationWillFinishLaunching in my app delegate but 
> strangely (to me) it is not called but applicationDidFinishLaunching is 
> called so I know my delegate is properly connected.
> 
> Are there some conditions that must be met  for 
> applicationWillFinishLaunching to be called?
> 
> What I want to do is ask for a serial number before the main window is 
> displayed as the serial number will determine the app configuration and hence 
> what appears in the main window.  So, I thought I would ask for the serial 
> number in applicationWillFinishLaunching thinking the main window will yet be 
> visible. I would the configure the app.
> 
> If there is a better way to accomplish this sequence of events I am all ears.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to