-
Notifications
You must be signed in to change notification settings - Fork 28.5k
[iOS]: Swift plugins crash when adopting UISceneDelegate #168228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@stuartmorgan-g is this a failure that we've run into in other circumstances with swift plugins where we are able to compile fine but at runtime the bridge classes are nil? |
As an experiment I moved the |
Jenn question if when it prints something like
is there a module map there? There is (albeit in a
|
Here is a similar crash where the user claimed it only happened in testflight: https://stackoverflow.com/questions/77206289/flutter-runs-locally-but-testflight-build-crashes-on-swift-getobjecttype I tried adding the linker flags |
I tried switching to swift package manager and it doesn't resolve the crash. |
So in the reproduction above, the crash happens when attempting to use the At the crash you can see the swiftplugin.framework is loaded:
I expect the symbols for the objc classes to exist in that binary, they do appear.
I am able to resolve the class with
That means we know the symbols is present in the binaries and it can be loaded, but for some reason |
Editing the |
Looking at the stacktrace again. It appears we are loading the register function fine. I got on a bit of a rabbit chase because |
Okay, I think I've track down the root of the problem. |
When following Apple's best practices of adopting UISceneDelegate, if the project uses any swift plugins, the project will crash at launch when plugins are registered because the objc bridge classes for swift FlutterPlugin subclasses will be nil.
I ran into this crash while trying to implement #167267, but I've also seen users in the wild running into this crash as well ( https://developer.apple.com/forums/thread/748671 ).
reproduction steps
flutter create -t plugin --platform=ios swiftplugin
cd swiftplugin
example/ios/Runner/Info.plist
(Note that the value of the fields don't need to be valid because startup will crash before it is used).cd example; flutter run
crash
Inspecting the type in the debugger after the crash looks like this:
doctor
The text was updated successfully, but these errors were encountered: