Im trying to open a specific FlutterViewController, when I close my application and try to open it with a universal link the application catch this exception: Flutter view controller 'NSInternalInconsistencyException', reason: 'Engine is required'. but im already initialized the flutter engine here in my AppDelegate.
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);
}
if the app is already open everything looks good.
Use dispatch main async. check if de function is already called and if not i call it when i create the FlutterViewController.
The problems was that I was trying to run the app with flutter in debug mode:
FLUTTER_BUILD_MODE = debug
To solve the issue I just changed it to release
.