Repository navigation
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listteam-iosOwned by iOS platform teamOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Steps to reproduce
When launching a debug build of a Flutter app from the home screen of iOS, the app will crash when trying to register plugins:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4378574848
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 104fbc000-105c5c000 [ 12.6M] r-x/r-x SM=COW /var/containers/Bundle/Application/7B913006-58CD-46F2-8AA4-1CDC1EE0E0C1/Runner.app/Runner
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [8436]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib 0x18b58369c swift_getObjectType + 40
1 connectivity_plus 0x107f32210 static SwiftConnectivityPlusPlugin.register(with:) + 64
2 connectivity_plus 0x107f325a8 @objc static SwiftConnectivityPlusPlugin.register(with:) + 56
3 connectivity_plus 0x107f30048 +[ConnectivityPlusPlugin registerWithRegistrar:] + 72
4 Runner 0x104fc4074 +[GeneratedPluginRegistrant registerWithRegistry:] + 116
5 Runner 0x104fc4a04 AppDelegate.application(_:didFinishLaunchingWithOptions:) + 100
6 Runner 0x104fc4e8c @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 196
This is a known problem:
In particular this is helpful:
This was supposed to be fixed by displaying an error message to the user rather than crashing, in Flutter 1.22:
flutter-team-archive/engine#20980
However, on Flutter 3.22, this dialog does not show for some reason.
Why can the underlying crash not be fixed, rather than displaying the error message?
Why is the error message not showing on latest Flutter?
Expected results
The app should not crash -- or at the very least, the error message should be shown.
Actual results
The app crashes 100% of the time on launch.
Code sample
N/A
Screenshots or Video
N/A
Logs
See full log at fluttercommunity/plus_plugins#2912 (comment)
Flutter Doctor output
Doctor output
% flutter doctor -v
[✓] Flutter (Channel beta, 3.22.0-0.3.pre, on macOS 14.5 23F79 darwin-x64, locale en-US)
• Flutter version 3.22.0-0.3.pre on channel beta at /Users/luke/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 87b652410d (5 weeks ago), 2024-04-23 21:41:18 -0500
• Engine revision b4bfd45986
• Dart version 3.4.0 (build 3.4.0-282.3.beta)
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/luke/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.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 17.0.10+0-17.0.10b1087.21-11572160)
[✓] VS Code (version 1.89.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.89.20240501
[✓] Connected device (3 available)
• iPhone SE (2nd generation) (mobile) • 00008030-000C38343C23402E • ios • iOS 17.4.1 21E236
• macOS (desktop) • macos • darwin-x64 • macOS 14.5 23F79 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.77
[✓] Network resources
• All expected network resources are available.
• No issues found!Reacted by Nils Reichardt
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listteam-iosOwned by iOS platform teamOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Activity
lukehutch commentedon May 28, 2024
OK, so actually I do see the error on the console:
Is there some way to display this on the device screen as a pop-up dialog?
Is there a fundamental reason why debug builds will never be manually launchable from the home screen?
jonahwilliams commentedon May 29, 2024
Debug builds use the JIT dart VM. iOS does not allow applications to launch JIT (essentially by blocking combinations of writable + executable memory that a JIT would need to create), unless there is a debugger attached.
lukehutch commentedon May 29, 2024
@jonahwilliams Thanks for explaining. Can Flutter just pop up a native error dialog on launch in this case? I have been trying for weeks to figure out why my app was crashing when launched from the home screen, and didn't see the console error until just now.
jonahwilliams commentedon May 29, 2024
I thought we used to do that, but I don't know what happened to it. its possible it broke along the way, or perhaps there were other changes that required it to be removed. I'll label the issue for triage and let the iOS team fill in the details.
[-]Crash when launching debug build from iOS home screen[/-][+]iOS debug mode warning doesn't work anymore.[/+]jonahwilliams commentedon May 29, 2024
The debug warning check is still there: https://github.com/flutter/engine/blob/main/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm#L481-L492
jonahwilliams commentedon May 29, 2024
Possibly the problem is that we never hit this point because something fails during plugin initialization instead.
lukehutch commentedon May 29, 2024
Well it is plugin registration that is failing, yes. Specifically
GeneratedPluginRegistrant::registerWithRegistryfails becauseregistrarForPluginreturnsnull, which is then passed to a non-nullable Swift parameterregistryin the plugin'sregister(with:)method.stuartmorgan-g commentedon May 29, 2024
registrarForPluginis annotated asnullable, so our generated registrant code is wrong; we should update it so that each line is a call to a static helper function that checks the registrar and no-ops if it's null.[-]iOS debug mode warning doesn't work anymore.[/-][+]Plugin registration crash if registrar is `null`[/+]jmagman commentedon May 29, 2024
flutter/packages/flutter_tools/lib/src/flutter_plugins.dart
Line 400 in bc097c6
jmagman commentedon May 29, 2024
Ugh I remember now, the nullability is different between iOS and macOS...
https://github.com/flutter/engine/blob/5ada2e116e9d5b2ae190e96ba224ab012f43296c/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h#L408
https://github.com/flutter/engine/blob/5ada2e116e9d5b2ae190e96ba224ab012f43296c/shell/platform/darwin/macos/framework/Headers/FlutterPluginRegistrarMacOS.h#L137
adityadua24 commentedon Aug 1, 2025
randallli commentedon Feb 27, 2026
Just ran into this on Flutter 3.38.5 (stable) with an iPhone 13 Pro Max running iOS 26.2.1.
The crash manifests in
audioplayers_darwin(AudioplayersDarwinPlugin.register(with:)→swift_getObjectTypeon nil), but the root cause is exactly as described above —registrarForPluginreturns nil andGeneratedPluginRegistrantpasses it through unchecked.I spent significant time investigating this, including fully regenerating the iOS project from scratch with
flutter createto rule out my own configuration. Confirming that release and profile builds work fine when launched from the home screen — only debug builds crash when launched from the home screen without a debugger attached.Adding a null check in
GeneratedPluginRegistrant(as @stuartmorgan-g suggested) or surfacing the existing ptrace error dialog before plugin registration would save developers a lot of debugging time. The current behavior — a raw SIGSEGV with no user-facing message — makes it very difficult to diagnose.Workaround for anyone else hitting this: use
flutter run --releaseorflutter run --profilefor standalone physical device testing. Debug builds must be launched via Xcode orflutter run, which attach the debugger that iOS requires for JIT execution. Debug builds launched from the home screen will always crash.fix: Register plugins after FlutterViewController attaches to the exp…