提问人:seena seena 提问时间:10/17/2022 最后编辑:seena seena 更新时间:10/18/2022 访问量:152
我的 Flutter Engine.Profiler (52):在 Swift 中EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
my flutter engine.profiler (52): EXC_BAD_ACCESS (code=EXC_I386_GPFLT) in swift
问:
我需要一直调用颤振引擎 .所以我给出了如下代码。
在 appdelegate.h 文件中
@property (nonatomic,strong) FlutterEngine *flutterEngine;
在 appdelegate.m 文件中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.flutterEngine = nil;
//Flutter module initialization
self.flutterEngine = [[FlutterEngine alloc] initWithName:@"my flutter engine"];
// Runs the default Dart entrypoint with a default Flutter route.
[self.flutterEngine run];
// Used to connect plugins (only if you have plugins with iOS platform code).
[GeneratedPluginRegistrant registerWithRegistry:self.flutterEngine];
}
然后 HomeVC.m 文件
FlutterEngine *flutterEngine = ((IKAppDelegate *)UIApplication.sharedApplication.delegate).flutterEngine;
if (flutterEngine != nil) {
}
flutterEngine = nil;
flutterEngine = [[FlutterEngine alloc] initWithName:@"my flutter engine"];
[flutterEngine run];
[GeneratedPluginRegistrant registerWithRegistry:flutterEngine];
FlutterViewController *flutterViewController = [[FlutterViewController alloc]initWithEngine:flutterEngine nibName:nil bundle:nil];
FlutterMethodChannel* moduleChannel = [FlutterMethodChannel
methodChannelWithName:@"com.ikea.kompis/nativeToFlutter"
binaryMessenger:flutterViewController.binaryMessenger];
[moduleChannel invokeMethod:@"nativeToFlutter"
arguments: jsonString
];
flutterViewController.modalPresentationStyle = UIModalPresentationFullScreen;
// [self presentViewController:flutterViewController animated:YES completion:nil];
[self presentViewController:flutterViewController animated:YES completion:nil];
但是像崩溃一样。 我的 Flutter Engine.3.Profiler (52):EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
这可能随时发生。那么如何解决这个问题 issuse
答: 暂无答案
评论