Skip to content

[UIScene] last minute sceneWillConnect registration is missing corner cases #185688

Description

@hellohuanlin

Here's the code that auto-registers an engine at the last minute:

if ([scene.delegate conformsToProtocol:@protocol(UIWindowSceneDelegate)]) {
NSObject<UIWindowSceneDelegate>* sceneDelegate =
(NSObject<UIWindowSceneDelegate>*)scene.delegate;
if ([sceneDelegate.window.rootViewController isKindOfClass:[FlutterViewController class]]) {
FlutterViewController* rootViewController =
(FlutterViewController*)sceneDelegate.window.rootViewController;
[self addFlutterManagedEngine:rootViewController.engine];
}
}

My understanding is that, this code is in-place because the engine hasn't been added to the listeners list when sceneWillConnect is called, So it performs a workaround at last minute, to see if the rootVC is a FlutterVC, and if so, registers the engine.

This is missing corner cases when FlutterVC isn't the rootVC.

Note that this is for multi-scene scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions