Fix launch failure on tvOS 26/27 by adopting the UIScene life cycle - #68
Open
KJRRR wants to merge 1 commit into
Open
Fix launch failure on tvOS 26/27 by adopting the UIScene life cycle#68KJRRR wants to merge 1 commit into
KJRRR wants to merge 1 commit into
Conversation
Apps linked against the tvOS 26 SDK or later must declare a UIApplicationSceneManifest. Without one, UIKit fails a launch-time assertion before any UIApplicationDelegate method runs: the app installs and shows a Home Screen icon, but terminates immediately with exit code 0 and produces no crash log. The Simulator does not enforce the assertion, so the app still runs there, which makes the failure easy to misdiagnose as a signing or provisioning problem. Declare a single default scene configuration and let the existing AppDelegate serve as the scene delegate, so no new files need to be added to the project. UISceneStoryboardFile carries over the same Main storyboard that UIMainStoryboardFile previously loaded. Under the scene life cycle applicationWillResignActive:, applicationDidEnterBackground:, applicationWillEnterForeground: and applicationDidBecomeActive: no longer fire, so the cookie save/restore driven by them is ported to the scene equivalents. Without that part the app launches correctly but silently loses cookies on every exit. Verified on Apple TV 4K (3rd generation) running tvOS 27.0 (24J5325d), Debug configuration, built with Xcode 27.0 (27A5228h). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On tvOS 26 and later the app installs and shows a Home Screen icon, but does nothing when launched. Selecting the icon returns straight to the Home Screen.
The failure signature is unusually misleading:
devicectl device process launchreports success, then the app terminates immediately with exit code 0devicectl device info processeswithin a secondThat last point in particular tends to send people toward signing/provisioning as the suspect, which is a dead end.
Cause
Apps linked against the tvOS 26 SDK or later must declare a
UIApplicationSceneManifestinInfo.plist. Without one, UIKit fails a launch-time assertion before anyUIApplicationDelegatemethod runs, so no app code executes and nothing is logged. The Simulator does not enforce the assertion, which is why it still runs there.This project has used the pre-scene lifecycle (
UIApplicationMain+UIMainStoryboardFile) since 2015, so it trips the assertion on every tvOS 26/27 device.Note this is determined by the SDK the app is linked against, not the deployment target. Since deploying to a tvOS 27 device requires an Xcode that supports tvOS 27, and that Xcode links against the tvOS 27 SDK, there is currently no way to sideload this project onto tvOS 27 without hitting it.
Likely the underlying cause of #67.
Fix
Info.plist— declare a single default scene configuration.UISceneStoryboardFilecarries over the sameMainstoryboard thatUIMainStoryboardFilepreviously loaded, andUIMainStoryboardFileis left in place for older tvOS versions.AppDelegate— conformed toUIWindowSceneDelegateand named as the scene delegate class. UIKit instantiates a separate scene-delegate instance of the same class, and the storyboard-created window is assigned to its existingwindowproperty automatically. Doing it this way means no new files are added to the.xcodeproj, keeping the diff small and avoiding project-file churn.Scene lifecycle callbacks — this part is not optional. Under the scene lifecycle,
applicationWillResignActive:,applicationDidEnterBackground:,applicationWillEnterForeground:andapplicationDidBecomeActive:stop firing entirely. This app drives its cookie save/restore from exactly those methods, so without porting them the app would launch fine but silently lose cookies and logins on every exit. The fivescene*equivalents call the samesaveCookiesToDefaults/restoreCookiesFromDefaultshelpers.(
application:didFinishLaunchingWithOptions:does still fire, so the initial restore is unaffected.)Testing
Verified working on Apple TV 4K (3rd generation), tvOS 27.0 (24J5325d), Debug configuration, built with Xcode 27.0 (27A5228h) against the tvOS 27.0 SDK. App launches, renders pages, and the top bar / remote interaction behave as before.
Scope of what I actually tested, stated plainly: one device, one tvOS version, Debug only. I have not verified Release builds, older Apple TV hardware, or tvOS 26 — though the mechanism is an Apple-wide SDK requirement rather than anything device-specific, so I would expect it to hold.
🤖 Generated with Claude Code