Skip to content
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

[Bug]: #1961

Open
sjustfly opened this issue Feb 18, 2024 · 1 comment
Open

[Bug]: #1961

sjustfly opened this issue Feb 18, 2024 · 1 comment

Comments

@sjustfly
Copy link

请描述遇到的问题,以及您所期望的正确的结果

在iOS上,当我从一个Flutter页面跳转原生UI的时候,在原生使用[self.navigationController setViewControllers:tmp animated:YES]; 重新调整了堆栈结构,会触发FBFlutterViewContainer类的

  • (void)didMoveToParentViewController:(UIViewController *)parent {
    if (!parent) {
    //当VC被移出parent时,就通知flutter层销毁page
    [self detachFlutterEngineIfNeeded];
    [self notifyWillDealloc];
    }
    [super didMoveToParentViewController:parent];
    }
    这样会导致Flutter引擎被释放掉,最终返回上级Flutter页面,会导致触发下面函数的assert(self.allContainers[uniqueId] != nil);断言
  • (void)activeContainer:(id)container
    forUniqueId:(NSString *)uniqueId {
    if (uniqueId == nil || container == nil) return;
    assert(self.allContainers[uniqueId] != nil);
    if ([self.activeContainers containsObject:container]) {
    [self.activeContainers removeObject:container];
    }
    [self.activeContainers addObject:container];
    }
    我觉得是didMoveToParentViewController中销毁Flutter页面的引擎的时机不太正确,没有支持到setViewControllers时的先移除又添加这种情况。

请说明如何操作会遇到上述问题

No response

在下面填入关键复现代码

复现的平台

Both

Flutter SDK版本

3.19.0

FlutterBoost版本

5.0.1

是否延迟初始化FlutterBoost

No

解决方案

@0xZOne
Copy link
Collaborator

0xZOne commented Feb 25, 2024

「我觉得是didMoveToParentViewController中销毁Flutter页面的引擎的时机不太正确,没有支持到setViewControllers时的先移除又添加这种情况。」

@sjustfly 欢迎提PR,一起共建~ 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants