'ios 15 prewarming causing appwillLaunch method when prewarm is done
We had an app in production which was reporting very high time to interact(tti) for ios 15 prewarm.
TTI = timewhenViewController is loaded - mainStartTime
mainStart time is measured inside AppDelegate.swift's willFinishLaunchingWithOptions method like this
mainStartTime = Date()
and when first view controller is loaded we measure tti as
tti = -(mainStartTime.timeIntervalSinceNow)
We observed that for prewarm scenarios mainStartTime was coming very early (approx 2 hours before user even launches the app).
I checked online but found no documentation. Just wanted to know can it possibly happen that prewarm is calling willFinishLaunchingWithOptions method while prewarming the app.
Solution 1:[1]
Apple's documentation is incorrect, here is the behaviour observed on iOS 15:
UIApplicationMain() always runs, including during prewarming.
What happens after this depends on whether your app uses the UIScene life-cycle.
For apps that do support scenes:
application:didFinishLaunchingWithOptions:may be called (doesn't always happen)scene:willConnectToSession:options:is not called - in fact theSceneDelegateis not created until the app is opened.
For apps that do not support scenes:
application:didFinishLaunchingWithOptions:is not called.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
