alibaba / alibaba/flutter_boost

[Bug]:

Open
#1,961 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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

在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

### 解决方案

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with FBFlutterViewContainer's didMoveToParentViewController: and the activeContainer:forUniqueId: path, then reproduce the iOS navigation-stack change using setViewControllers:. Trace the container and engine lifecycle during removal and re-addition; done means returning to the Flutter page no longer triggers the allContainers assertion or loses the required engine.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, ios, objective-c
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.