-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to reproduce
flutter create my_appcd my_appet run --config ios_debug_sim_unopt_arm64- Quit the app once it launches
- Open
my_app/ios/Runner.xcworkspace - In Xcode do Product > Run
Note: Error does not always happen since it's a race condition, you may need to do step 6 multiple times. It is more likely to happen if you setup UIScene in your Info.plist, but I have seen it happen for both. Also, the crash can also happen when running from the Flutter CLI, but running from Xcode is faster and allows you to see the error log.
Expected results
App should run fine when using a local engine
Actual results
App crashes
[FATAL:flutter/shell/platform/darwin/ios/platform_view_ios.mm(156)] Check failed: accessibility_bridge_.
| FML_DCHECK(accessibility_bridge_); |
I tried tracing it down and it appears that occasionally FlutterEngine enables semantics before the _handleFrameworkSemanticsEnabledChanged listener is set up.
flutter/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Lines 345 to 351 in 7a13e1b
| - (void)enableSemantics:(BOOL)enabled withFlags:(int64_t)flags { | |
| if (!self.platformView) { | |
| return; | |
| } | |
| self.platformView->SetSemanticsEnabled(enabled); | |
| self.platformView->SetAccessibilityFeatures(flags); | |
| } |
| addSemanticsEnabledListener(_handleFrameworkSemanticsEnabledChanged); |
And therefore, the semantics tree is never enabled:
flutter/packages/flutter/lib/src/semantics/binding.dart
Lines 168 to 170 in 7a13e1b
| void _handleFrameworkSemanticsEnabledChanged() { | |
| platformDispatcher.setSemanticsTreeEnabled(semanticsEnabled); | |
| } |
Likely caused by #174163.
Code sample
Use default flutter create sample app
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel main, 3.36.0-1.0.pre-348, on macOS 15.6.1 24G90 darwin-arm64, locale en)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
[✓] Chrome - develop for the web
[✓] Connected device (4 available)
[✓] Network resources
• No issues found!