Hey Flutter Community,
I’ve encountered a puzzling runtime crash specifically on iOS, and I’m hoping someone might have seen something similar or have some ideas.
The Problem:
My Flutter app builds, installs, and runs perfectly fine on my iOS device when I run it tethered – either using flutter run
or building/running directly from Xcode with the debugger attached.
However, when I try to run the app untethered (i.e., launching it directly from the device’s home screen after installing it via flutter build ipa
, flutter build ios --release
, or detaching the debugger from a tethered build), the app crashes immediately on launch. It builds and installs without error, but crashes right away when opened standalone.
Crash Log:
The crash occurs on the main thread during what looks like the view controller initialization:
`Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [47806]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 Flutter 0x10805624c -[VSyncClient initWithTaskRunner:callback:] + 300
1 Flutter 0x108041298 -[FlutterViewController createTouchRateCorrectionVSyncClientIfNeeded] + 216
2 Flutter 0x10803ed68 -[FlutterViewController viewDidLoad] + 396
3 UIKitCore 0x195ad20ec -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
4 UIKitCore 0x1956721a4 -[UIViewController loadViewIfRequired] + 935
5 UIKitCore 0x195671ddc -[UIViewController view] + 23
6 UIKitCore 0x19592a2c0 -[UIWindow addRootViewControllerViewIfPossible] + 135
… (Further down the stack trace leading to UIApplicationMain)`
(Full crash log available if needed)
Environment:
- Flutter Version: 3.29.2 (Channel stable, Framework revision c236373904)
- Dart Version: 3.7.2
- Xcode Version: 16.2 (Build 16C5032a)
- macOS Version: 15.3.2 (Build 24D81 darwin-arm64)
- CocoaPods Version: 1.16.2
- Target Device: iPhone - iOS 18.4 (Build 22E240)
What I’ve Tried:
flutter clean
flutter pub get
- Deleting
ios/Pods/
,ios/Podfile.lock
,ios/.symlinks/
- Running
pod install --repo-update
within theios/
directory - Restarting Mac / Xcode / Device
- Checked basic Signing & Capabilities settings in Xcode.
- Ensured build configurations (Debug vs. Release) don’t have obvious discrepancies, although the issue might lie here.
My Suspicion:
Since it runs perfectly fine when tethered (Debug mode likely) but crashes immediately when run standalone (Release/Profile mode likely), I suspect the issue might be related to:
- Build Configuration Differences: Something specific to the Release or Profile build configuration (optimizations, code stripping, different compile-time flags) is causing this runtime crash during initialization.
- Initialization Order/Timing: Perhaps some initialization depends on the debugger being attached, or timing changes slightly in Release mode, exposing a race condition or null pointer access (like the
KERN_INVALID_ADDRESS at 0x0
). - Flutter Engine Issue: Maybe a subtle issue within the Flutter engine’s VSync or view setup specific to this version/environment/configuration.
- Dependency Conflict: A native dependency behaving differently in Release mode.
My Plan & Ask:
For now, I can continue development by relying on tethered builds, so I’m not completely blocked. I plan to park this specific issue temporarily to keep momentum on feature development.
However, I wanted to post this here in case anyone has encountered a similar immediate crash (SIGSEGV
in VSyncClient
or FlutterViewController viewDidLoad
) specifically in untethered/Release/Profile builds on iOS. Any pointers on specific Xcode build settings (like Optimization Level, Compilation Mode, Dead Code Stripping), known issues with recent Flutter/Xcode versions, or debugging strategies for release-mode crashes would be incredibly helpful!
Thanks so much in advance for any suggestions!