-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to reproduce
I recently discovered an iOS-specific crashing issue in two of my apps that appears to have started from a Flutter merge 2 weeks ago (Mar 7, 2024) (the Flutter version before the commit had no issues; I switched back and forth twice). For troubleshooting and creating a minimal reproducible example, knowing the commits prior to that merge worked, I moved back to developing on the latest version of Flutter.
Roll Flutter Engine from 175069397a40 to 80cd7981043f (5 revisions)
Commit: d632f34 | Mar 7, 2024, 4:13 PM
The crashing issue happens when loading certain layouts or widgets, then tapping an InkWell (or GestureDetector) in the AppBar. That tap will either:
- crash the app on an iOS simulator (I've been using an iPad simulator), or
- hit a debug breakpoint in Xcode (even if running from VS Code, which apparently runs via Xcode) when building to a physical device (I have an iPad), but the breakpoint is in a very unidentifiable area, and so made no sense to me (screenshot attached).
The fixes for the crash are multifold (and are numbered in the code), and I've no idea which fix (of 5), if any, would be the most proper—if not the root—fix, because I've no idea what the root cause is. And I'm really only looking for advice on which fix(es) might be the better fixes to implement.
In the beginning, because I found #2 and #3 at the same time, I figured it had to do with having a Card nested in another Card, with both having a clipBehavior, because commenting out either clipBehavior property worked. But then I found the other three fixes where it also didn't crash, which left me with no clue.
Disclaimer: I only have one physical iOS device, so unsure if any or all of these issues and/or fixes will apply on other iOS devices. I hope someone else can reproduce it.
To Recreate:
- Build and run the provided code example on an iOS device or simulator.
- Tap the title in the AppBar.
Note: If code was changed and hot-refreshed, the first tap could be buffered and the 2nd tap may cause the crash (if expected). Tapping two or more times for testing is recommended.
Expected results
Expected result: Tapping the title in the AppBar one or more times, the console log should output one line per tap, and the app should not crash.
Actual results
- Observe the app:
3a. Crashes (iPad simulator) with the console message, "Lost connection to device.", or,
3b. Hits a raster-level breakpoint in Xcode (physical iPad).
- Anecdotally, an iPad simulator crashed, while a physical iPad popped up a breakpoint in Xcode (despite running in VS Code).
- When the physical device hit the breakpoint in Xcode, I 'continued' the step-through over 60 times, and eventually had to just stop the runner.
- Other than the one-line console output after the crash on the simulator, no logs were dumped in either case.
Code sample
Code Example:
Gist: https://gist.github.com/KDCinfo/ba5d7209197f6c94231753e42baf36c6
DartPad: https://dartpad.dev/?id=ba5d7209197f6c94231753e42baf36c6
Screenshots or Video
Logs
No logs were provided for either the simulator crash, or when the Xcode breakpoint was hit on a physical iPad.
Flutter Doctor output
Doctor output
```console Mac: MacOS Sonoma Version 14.4iPad (physical): iPadOS Version 17.1.2 | iPad mini (5th gen)
iPad (simulator): iPadOS Version 17.0.1 | iPad Pro (12.9-in; 2nd gen)
```console
[✓] Flutter (Channel master, 3.21.0-11.0.pre.32, on macOS 14.4 23E214 darwin-x64, locale en-US)
• Flutter version 3.21.0-11.0.pre.32 on channel master at /Users/keithdc/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 28498fe18a (2 days ago), 2024-03-19 12:25:57 -0400
• Engine revision 59138d5f8e
• Dart version 3.4.0 (build 3.4.0-247.0.dev)
• DevTools version 2.34.0-dev.5
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/keithdc/Library/Android/sdk
• Platform android-32, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A507
• CocoaPods version 1.14.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.87.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (3 available)
• Keith D’s iPad (mobile) • 00008020-000C79160C81402E • ios • iOS 17.1.2 21B101
• macOS (desktop) • macos • darwin-x64 • macOS 14.4 23E214 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.129
[✓] Network resources
• All expected network resources are available.
• No issues found!
