Skip to content

Fix iOS 18 startup crash by migrating to UIScene APIs#1

Open
MarcinusX wants to merge 1 commit into
masterfrom
fix/ios18-uiscene-migration
Open

Fix iOS 18 startup crash by migrating to UIScene APIs#1
MarcinusX wants to merge 1 commit into
masterfrom
fix/ios18-uiscene-migration

Conversation

@MarcinusX
Copy link
Copy Markdown
Collaborator

Summary

  • Fix iOS 18 startup crash caused by deprecated UIApplication.shared.delegate?.window and UIApplication.shared.keyWindow APIs returning nil due to Flutter 3.38's UIScene lifecycle changes
  • Add getRootViewController() helper using iOS 13+ UIApplication.shared.connectedScenes API with fallback for older versions
  • Use lazy root view controller fetching instead of requiring it at plugin registration time

Test plan

  • Build iOS app successfully
  • App starts without crash on iOS 18
  • Contact functionality works (open contact form, existing contact, device picker)

🤖 Generated with Claude Code

Migrate from deprecated UIApplication window access patterns to iOS 13+
UIScene-based APIs. This fixes crashes on iOS 18 where Flutter 3.38's
UIScene lifecycle changes cause the old APIs to return nil.

Changes:
- Add getRootViewController() helper using connectedScenes API
- Use lazy root view controller fetching instead of at registration time
- Update openContactForm(), cancelContactForm(), openExistingContact(),
  and openDeviceContactPicker() to use the new helper
- Replace keyWindow?.frame with UIScreen.main.bounds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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