Hello,
We are migrating a large UIKit app from the app-delegate lifecycle to the UIScene lifecycle. (Building with Xcode 27 / iOS 27 SDK, our non-scene app crashes at launch with EXC_BREAKPOINT in _UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption.) Our startup work runs from application(_:didFinishLaunchingWithOptions:), and we need to know what is guaranteed for background launches.
Observed (iPhone 15 Pro, iOS 27.2, app built with Xcode 26.3; also iOS 17.5 simulator):
- Non-scene build, launched by a content-available push:
launchOptionscontainedUIApplicationLaunchOptionsRemoteNotificationKey.applicationDidEnterBackgroundwas not called during the background run. - Non-scene build, launched by a
BGProcessingTask:launchOptionsempty.applicationDidEnterBackgroundwas not called; the first lifecycle callback wasapplicationWillEnterForegroundwhen the user opened the app 8 minutes later. - Scene build, launched by a
BGProcessingTaskand by a content-available push:scene(_:willConnectTo:options:)was called 0.15-0.2 s afterdidFinishLaunchingwhileapplicationState == .background(activationState.unattached).connectionOptionshad nonotificationResponse, URL or shortcut item. In the push launch,scene(_:willConnectTo:options:)was called 37 ms beforeapplication(_:didReceiveRemoteNotification:fetchCompletionHandler:).sceneWillEnterForeground/sceneDidEnterBackgroundwere not called before the process was suspended. - Scene build, background URLSession relaunch (simulator): the scene also connected right after
didFinishLaunchingin the background, 6 ms beforeapplication(_:handleEventsForBackgroundURLSession:completionHandler:).
Question: For a UIScene-based app that the system launches directly into the background (content-available push, BGTaskScheduler task, background URLSession events), is it guaranteed that UIKit connects a scene session (scene(_:willConnectTo:options:)) before the user opens the app, or can a background launch run with no connected scene until the app comes to the foreground? In the same launches, can sceneDidEnterBackground (or applicationDidEnterBackground in a non-scene app) be called for a process that never entered the foreground?
Please point us to documentation that describes the guaranteed callbacks and their order for background launches.
Thank you.