我试图打开一个特定的 FlutterViewController,当我关闭应用程序并尝试使用通用链接打开它时,应用程序捕获此异常: Flutter 视图控制器“NSInternalInconsistencyException”,原因:“需要引擎”。 但我已经在我的 AppDelegate 中初始化了 flutter 引擎。
override func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
self.flutterStart()
return true
}
func flutterStart() {
flutterEngine.run()
// Connects plugins with iOS platform code to this app.
GeneratedPluginRegistrant.register(with: self.flutterEngine);
}
如果应用程序已经打开,一切看起来都很好。
使用调度主异步。 检查 de 函数是否已经被调用,如果没有,我在创建 FlutterViewController 时调用它。