英文:
Flutter is crashing my application when I try to open it with a UniversalLink
问题
我试图打开特定的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()
// 将插件连接到此应用程序的iOS平台代码。
GeneratedPluginRegistrant.register(with: self.flutterEngine);
}
如果应用程序已经打开,一切看起来都很好。
请使用dispatch main async。
检查函数是否已调用,如果尚未调用,则在创建FlutterViewController时调用它。
英文:
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.
答案1
得分: 0
问题在于我试图在调试模式下运行Flutter应用程序:
FLUTTER_BUILD_MODE = debug
为了解决这个问题,我只是将其更改为 release
。
英文:
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
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论