Open ethi1989 opened 3 years ago
same +
Steps to Reproduce
我使用的是官方提供的example_swift,进行原生跳转flutter的试验,从Flutter跳转回来后,并未回调onPageFinished
class ViewController: UIViewController {
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func onClickPushFlutterPage(_ sender: UIButton, forEvent event: UIEvent){ FlutterBoostPlugin.open("first", urlParams:[kPageCallBackId:"MycallbackId#1"], exts: ["animated":true], onPageFinished: { (_ result:Any?) in print(String(format:"call me when page finished, and your result is:%@", result as! CVarArg)); }) { (f:Bool) in print(String(format:"page is opened")); } } @IBAction func onClickPresentFlutterPage(_ sender: UIButton, forEvent event: UIEvent){ FlutterBoostPlugin.present("second", urlParams:[kPageCallBackId:"MycallbackId#2"], exts: ["animated":true], onPageFinished: { (_ result:Any?) in print(String(format:"call me when page finished, and your result is:%@", result as! CVarArg)); }) { (f:Bool) in print(String(format:"page is presented")); } }
}
Flutter Boost Version 1.17.1,Flutter VERSION: 1.22.1 Flutter Target Platform: iOS 10 Target OS version/browser: IOS 13.6 Devices: IPHONE 7
Logs
Flutter Boost Version 1.17.1,Flutter VERSION: 1.22.1 Flutter Target Platform: iOS 10 Target OS version/browser: IOS 13.6 Devices: IPHONE 17
present吧?试了下open回调了
找到原因了, example没在delegate里记录回调。解决方法如下,供参考:
在pushFlutterRoute方法中记录onPageFinished,例如resultTable[options.pageName] = options.onPageFinished;
然后在popRoute方法中触发onPageFinished,if let onPageFinished = resultTable[options.pageName] { onPageFinished(options.arguments) resultTable.removeValue(forKey: options.pageName) }
Steps to Reproduce
我使用的是官方提供的example_swift,进行原生跳转flutter的试验,从Flutter跳转回来后,并未回调onPageFinished
class ViewController: UIViewController {
}
Flutter Boost Version 1.17.1,Flutter VERSION: 1.22.1 Flutter Target Platform: iOS 10 Target OS version/browser: IOS 13.6 Devices: IPHONE 7
Logs
Flutter Boost Version 1.17.1,Flutter VERSION: 1.22.1 Flutter Target Platform: iOS 10 Target OS version/browser: IOS 13.6 Devices: IPHONE 17