Date
1 - 7 of 7
Show splash screen before finished launching?
James Walker
I’m trying to show a splash screen in applicationWillFInishLaunching:, but it doesn’t actually appear until applicationDidFinishLaunching: seconds later. I’ve done all I can think of to make it show up:
[NSApp activateIgnoringOtherApps: YES]; [splashWindow orderFrontRegardless]; [splashWindow display]; Is there anything else I can do to make the window draw? |
|
Jon Gotow
Try putting this after your orderFront call:
toggle quoted message
Show quoted text
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; The runloop basically has to do at least one iteration before the new window will actually be mapped to the screen. - Jon On Sep 6, 2018, at 12:17 PM, James Walker <list2@...> wrote: |
|
James Walker
On Sep 6, 2018, at 1:39 PM, Jon Gotow <gotow@...> wrote: Tried that, no change. - JonOn Sep 6, 2018, at 12:17 PM, James Walker <list2@...> wrote: |
|
Jon Gotow
Hmph - now that you mention it, there's no current runloop at that point - the app is still launching. So [NSRunloop currentRunLoop] is probably returning nil. You could grabbing mainRunLoop and running that, but I don't know what impact that's going to have during the app launch process.
toggle quoted message
Show quoted text
- Jon On Sep 6, 2018, at 2:59 PM, James Walker <list2@...> wrote: |
|
James Walker
On Sep 6, 2018, at 2:03 PM, Jon Gotow <gotow@...> wrote:I wondered about that myself, and logged out the values of [NSRunloop currentRunLoop] and [NSRunloop mainRunLoop]. They showed the same non-nil value. |
|
Quincey Morris
Coming at this from the other side, why does it take enough seconds to get from willFinishLaunching to didFinishLaunching that you care? If you can reduce that time a bit, maybe you don’t have to solve the original problem. IIRC from the last time this topic was discussed, getting windows displayed earlier than didFinishLaunching is pretty treacherous. |
|
James Walker
On Sep 6, 2018, at 5:13 PM, Quincey Morris <quinceymorris@...> wrote:I come here looking for a simple solution, and you try to make me THINK? That’s hardly fair. :-)On Sep 6, 2018, at 11:17 , James Walker <list2@...> wrote:Coming at this from the other side, why does it take enough seconds to get from willFinishLaunching to didFinishLaunching that you care? If you can reduce that time a bit, maybe you don’t have to solve the original problem. I managed to move some work onto a different thread, and fix a place where my main thread was getting blocked for a while. Though it would still be nice to solve this mystery. New clue: if I run the app in Xcode using the option "Launch application without state restoration", then the splash window appears sooner. |
|