Is it possible to determine the time the current app was launched from the moment the launch screen is first shown? I want to ensure that the launch screen is shown for a certain minimum amount of time.
-
Why not use a timer? – rebello95 Sep 10 '14 at 18:38
-
Because my code won't actually execute until *after* the launch image goes away so I'll have no idea how long it has already been shown for. – devios1 Sep 10 '14 at 18:39
-
Or at least I'm assuming that. I don't actually know that for sure. – devios1 Sep 10 '14 at 18:40
-
1In fact you should not. It violates Apple iPhone Human Interface Guidelines (HIG). Read this [thread](http://stackoverflow.com/questions/553336/how-can-i-display-a-splash-screen-for-longer-on-an-iphone). – ForguesR Sep 10 '14 at 18:44
-
Well like 99% of other apps, we're using the splash screen to show a logo, so already it doesn't agree with the HIG. – devios1 Sep 10 '14 at 18:45
-
@chaiguy `99%` seems a little lofty... none of my organization's iOS apps do this. – admdrew Sep 10 '14 at 18:46
-
Show a logo with "Loading" message. Then show the same logo with "Tap here" to start or anything else (a menu?). If you don't do that and add some kind of sleep function then the user thinks the app is slow to start and this is what Apple wants to avoid. – ForguesR Sep 10 '14 at 18:47
2 Answers
This creates the perception that your app is less responsive and is generally a bad user experience. But from a technical standpoint, drop breakpoints or NSLog
s in each of the delegate methods on UIApplicationDelegate
to see what order they fire in, and run your application in Time Profiler to see what's spending time.
There are WWDC sessions specifically on reducing the time from a user tapping your app icon until the time when your app is fully launched and ready for user interaction. The best user experience comes from making this time as near-zero as possible. Users do not enjoy looking at your company logo, and this is prohibited by the HIG.

- 7,143
- 1
- 30
- 49
-
I personally agree with this, but it's not my decision. I don't plan on making the delay more than a half-second. And in fact my reason for asking this question is to reduce that even further, by accounting for how long the launch image has already been displayed for, so I don't needlessly draw this out even longer for the user. – devios1 Sep 10 '14 at 18:49
-
If this is coming down from the product owner, the best route is probably to look at dropping those breakpoints in (and in `main()`) and keeping time between them. If you can get your average launch time to, for example, 200ms, then delay for a further 300ms, would that make the product owner happy? – wjl Sep 10 '14 at 18:52
-
Let's hope so! I don't like the idea of artificially slowing a launch down any more than you do. – devios1 Sep 10 '14 at 18:59
I would suggest capturing the current time in your app delegate's -[id<UIApplicationDelegate> application:applicationWillFinishLaunchingWithOptions:]
method and storing that value for use later.
-
-
-
Since you asked, I benchmarked the difference at 0.84 seconds in the app I'm currently working on (while running in the debugger with breakpoints disabled). So it's significant. `main()` looks the best bet so far. – devios1 Sep 10 '14 at 18:57
-
That's huge. I had expected it to be on the order of 100 ms. What hardware were you running that on? – Holly Sep 11 '14 at 18:07
-
iPhone 5. However, having the debugger attached *really* slows things down, so don't expect that to be indicative of real-life performance. – devios1 Sep 11 '14 at 18:45