Repository navigation
iOS / tvOS: adopt the UIScene lifecycle (apps crash at launch on iOS / tvOS 27) - #8643
Merged
Merged
Conversation
…/ tvOS 27) Fixes openframeworks#8639. ofxiOSSceneDelegate (ofAppiOSWindow.mm) attaches the window the app delegate already creates in applicationDidFinishLaunching: to the connecting UIWindowScene, and forwards the scene's active / resign / background / foreground events and opened URLs to the app delegate's existing methods. The iOS and tvOS template Info.plists name it in UIApplicationSceneManifest. App delegates, including ones started with startAppWithDelegate, are unchanged.
Removed deprecated URL handling for tvOS.
Member
|
Looks like this broke on tvOS. Should prob wait to merge before all checks are passed. |
This was referenced Nov 5, 2026
danoli3
added a commit
that referenced
this pull request
Nov 5, 2026
#8643's ofxiOSSceneDelegate forwards opened URLs to the app delegate. application:handleOpenURL: is API_UNAVAILABLE(tvos), so tvOS+OFLib fails on Xcode 27: ofAppiOSWindow.mm:93: error: 'application:handleOpenURL:' is unavailable The first commit of #8643 already skipped that selector with #if !TARGET_OS_TV; a later commit in the squash dropped the guard. Restore the guard and implement application:openURL:options: on ofxtvOSAppDelegate so the scene path still delivers URLs on tvOS.
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.
Fixes #8639.
On iOS 27 and tvOS 27, UIKit stops every app that hasn't adopted the UIScene lifecycle at launch, before
setup():ofxiOS still used the app-delegate lifecycle from before iOS 13, so no openFrameworks iOS or tvOS app could start on them.
Change
ofxiOSSceneDelegate(inofAppiOSWindow.mm, which builds for iOS and tvOS, so no project files change):applicationDidFinishLaunching:(window.windowScene = scene) and shows it.sceneDidBecomeActive/sceneWillResignActive/sceneWillEnterForeground/sceneDidEnterBackgroundto the app delegate'sapplicationDidBecomeActive:etc. UIKit no longer calls those in scene-based apps, and ofxiOS uses them for focus, animation andglFinish().scene:openURLContexts:, including the launch URL) toapplication:openURL:options:, or on iOS toapplication:handleOpenURL:.Info.plists (scripts/templates/ios/ofxiOS-Info.plist,scripts/templates/tvOS/ofxtvOS-Info.plist): a single-sceneUIApplicationSceneManifestthat namesofxiOSSceneDelegate. Naming it in the plist, rather than returning it from the app delegate, means it also works with custom app delegates (ofAppiOSWindow::startAppWithDelegate) that don't subclassofxiOSAppDelegate.ofxiOSAppDelegate,ofxtvOSAppDelegateand their subclasses are unchanged. They still create the window and view controller inapplicationDidFinishLaunching:.Existing projects keep their own
ofxiOS-Info.plist/ofxtvOS-Info.plist, so they need the sameUIApplicationSceneManifestentry added to run on iOS / tvOS 27.Tested
Xcode 27.1 on the iOS 27.2 and tvOS 27.2 Simulators. I built each template's app with CMake, switching
windowControllerTypebetween GLKit and Core Animation, and rebuilt the core with this change:setup()/ firstdraw()GL_KITCORE_ANIMATIONGL_KITCORE_ANIMATIONBefore the change, both templates stopped at launch with the
EXC_BREAKPOINTabove.Not tested here:
The scene APIs exist since iOS / tvOS 13, so older versions should run the same code.
Separate, maybe existing: on tvOS,
ofGetWidth()/ofGetHeight()report 1080 × 1920 (portrait) while the app correctly fills the 1920 × 1080 screen. No tvOS 27 app could run before this change, so I couldn't compare. ofxiOS's orientation handling treats tvOS like a portrait device, so it's probably not new, but it's worth checking.