Skip to content

Adopt UIScene lifecycle to fix demo app launch crash on iOS 27 - #152

Merged
aaronbrethorst merged 1 commit into
mainfrom
fix/ios27-scene-lifecycle
Jul 29, 2026
Merged

Adopt UIScene lifecycle to fix demo app launch crash on iOS 27#152
aaronbrethorst merged 1 commit into
mainfrom
fix/ios27-scene-lifecycle

Conversation

@aaronbrethorst

@aaronbrethorst aaronbrethorst commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixes an immediate launch crash of OTPKitDemo on iOS 27 simulators/devices: builds with the iOS 27 SDK enforce UIScene lifecycle adoption, and the demo crashed with EXC_BREAKPOINT in __UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption because it created its UIWindow in the app delegate with no scene delegate.
  • Adds a SceneDelegate that owns the window and root view controller selection (onboarding vs. main trip planner), using UIWindow(windowScene:); AppDelegate is slimmed to a bare UIApplicationDelegate.
  • Declares a static UIApplicationSceneManifest in OTPKitDemo-Info.plist and removes the INFOPLIST_KEY_UIApplicationSceneManifest_Generation build settings so the manifest has a single source of truth (the generated one had no delegate class and would conflict with the hand-authored key).

Test plan

  • Reproduced the pre-fix crash on an iOS 27.0 simulator (iPhone 17 Pro, Xcode 27.0 beta): EXC_BREAKPOINT in __UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption at launch.
  • Post-fix, verified on the same simulator: fresh install shows onboarding; tapping Continue cross-dissolves to the trip planner (exercises the relocated showMainViewController path); location-permission prompt handled; map renders.
  • Terminate + relaunch goes straight to the trip planner (exercises the hasCompletedOnboarding restore branch in SceneDelegate); no new crash reports across any run.
  • xcodebuild test -scheme OTPKit passes (iPhone 17 Pro Max, iOS 26.3.1).
  • SwiftLint clean on the changed files.

Review notes (non-blocking, pre-existing)

  • The onboarding persistence contract (hasCompletedOnboarding / otpServerURL / selectedRegion keys + JSON-coded OTPRegionInfo) is still spelled out independently by the writer (OnboardingViewController) and the reader (now SceneDelegate). Consolidating it into a small shared store (and possibly dropping the derivable hasCompletedOnboarding flag) would be a good follow-up; left out here to keep the migration diff minimal.
  • The demo scheme's test action is broken on main independent of this change: it references OTPKitDemoTests/TestPlan.xctestplan, which no longer exists (the demo test target was removed in an earlier reorganization).
  • The old debug print statements in the launch path (including one that already claimed to be "SceneDelegate") were dropped rather than carried over.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Apps built with the iOS 27 SDK must adopt the UIScene lifecycle;
OTPKitDemo crashed at launch with EXC_BREAKPOINT in
__UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption because
it created its window in the app delegate with no scene delegate.

- Add SceneDelegate owning the window and root view controller
  selection (onboarding vs. main), using UIWindow(windowScene:)
- Slim AppDelegate to a bare UIApplicationDelegate
- Declare a static UIApplicationSceneManifest in OTPKitDemo-Info.plist
  and drop the INFOPLIST_KEY_UIApplicationSceneManifest_Generation
  build settings so the manifest has a single source of truth
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@aaronbrethorst, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8edec803-09f2-4de6-9f73-7da005cc3252

📥 Commits

Reviewing files that changed from the base of the PR and between 50f4a50 and ac6eadf.

📒 Files selected for processing (4)
  • Demo/OTPKitDemo-Info.plist
  • Demo/OTPKitDemo.xcodeproj/project.pbxproj
  • Demo/OTPKitDemo/AppDelegate.swift
  • Demo/OTPKitDemo/SceneDelegate.swift

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@aaronbrethorst
aaronbrethorst merged commit e5e9737 into main Jul 29, 2026
5 checks passed
@aaronbrethorst
aaronbrethorst deleted the fix/ios27-scene-lifecycle branch July 29, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant