我的 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

提问人:seena seena 提问时间:10/17/2022 最后编辑:seena seena 更新时间:10/18/2022 访问量:152

问:

我需要一直调用颤振引擎 .所以我给出了如下代码。

在 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

objective-c 内存管理 exc-bad-access flutter-engine

评论

0赞 JeremyP 10/17/2022
嗨,我删除了 Swift 标签,因为这显然是一个 Objective-C 问题,而不是一个 Swift 问题。
0赞 seena seena 10/18/2022
有没有解决此问题的解决方案
0赞 JeremyP 10/18/2022
它在哪条线上崩溃?
0赞 seena seena 10/18/2022
@JeremyP我有一个按钮,因为我给了这个颤振功能。当我在某个时候点击该按钮时,它会崩溃。显示为 :-my flutter engine.3.profiler (52): EXC_BAD_ACCESS ....可能是第 7 次..如果在按钮中单击第 7 次,它会崩溃 :-so 它显示为 :- my flutter engine.7.profiler (52): EXC_BAD_ACCESS.所以这种崩溃随时都会发生......如何解决这个问题 issuse
0赞 seena seena 10/18/2022
有没有解决此问题的解决方案

答: 暂无答案