alibaba / alibaba/flutter_boost
swift中通过addChild()添加一个FBFlutterViewContainer子视图到当前页面上时,侧滑返回必崩溃,而且无法禁止侧滑返回。
- Dominant language
- Dart
- Stars
- 7.2k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
在原来的swift项目上集成flutter,
Flutter版本: 3.7.7
FlutterBoost: 4.2.0
iPhone 11 , iOS 16.3.1
复现流程:
在原生的二级页面上,通过addChild()的方式将一个FBFlutterViewContainer实例添加到当前页面上,通过侧滑返回时程序产出崩溃。
如果通过addChild()添加多个子页面,有原生UIViewController也有FBFlutterViewContainer时,如果侧滑时当前显示的是一个原生页面,不会产生崩溃,如果侧滑时当前是一个FBFlutterViewContainer页面,必定产生崩溃。
并且addChild一个FBFlutterViewContainer页面后,在当前页面上使用navigationController?.interactivePopGestureRecognizer?.isEnabled = false来视图关闭侧滑返回功能将不会生效(addChild中没有FBFlutterViewContainer页面时,是生效的)
崩溃日志:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSSingleObjectArrayI objectAtIndex:]: index 18446744073709551615 beyond bounds [0 .. 0]'
terminating with uncaught exception of type NSException
可复现的代码实例:
override func viewDidLoad() {
super.viewDidLoad()
let controller:FBFlutterViewContainer = FBFlutterViewContainer()
controller.setName("trustCirclePage", uniqueId: nil, params: nil, opaque: true)
addChild(controller)
view.addSubview(controller.view)
controller.view.snp.makeConstraints { make in
make.top.left.right.bottom.equalToSuperview()
}
controller.didMove(toParent: self)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.interactivePopGestureRecognizer?.isEnabled = false
}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the addChild() integration and navigationController?.interactivePopGestureRecognizer?.isEnabled path shown in the reproduction; compare behavior when the child is an FBFlutterViewContainer versus a native UIViewController. Done means the reproducible iOS case no longer crashes during interactive pop and disabling the gesture works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100