简体   繁体   English

Flutter iOS 上的插件抛出错误“线程 1:EXC_BAD_ACCESS”

[英]Flutter Plugin Throwing Error "Thread 1: EXC_BAD_ACCESS" on iOS

I've been attempting to use the plugin "livechatt" found at https://pub.dev/packages/livechatt in my Flutter application.我一直在尝试在我的 Flutter 应用程序中使用位于https://pub.dev/packages/livechatt的插件“livechatt”。 I had no issue getting it to work in the Android release, but on iOS, it fails in the same way every time.我没有问题让它在 Android 版本中工作,但在 iOS 上,它每次都以同样的方式失败。

I imported the package in my pubspec.yaml the same way I have with every other plugin.我在我的pubspec.yaml中导入了 package,就像我在其他所有插件中一样。 When running the app in the iOS simulator from Android Studio, the build succeeds, but the app crashes immediately after boot.在 Android Studio 的 iOS 模拟器中运行应用程序时,构建成功,但应用程序在启动后立即崩溃。 When running the app from Xcode, the build succeeds, but the app freezes on the launch-splash screen.从 Xcode 运行应用程序时,构建成功,但应用程序在启动启动屏幕上冻结。

NOTE: As it stands, the plugin does have an error with its dependency in iOS, so those testing it will need to change the target OS from iOS 9.0 to iOS 11.0 in livechatt.podspec , and then run pod install in the project's iOS directory to sync the changes注意:就目前而言,该插件在 iOS 中的依赖性确实存在错误,因此那些测试它的人需要将目标操作系统从 iOS 9.0 更改为 livechatt.podspec 中的livechatt.podspec 11.0,然后在项目的 iOS 目录中运行pod install同步更改

Xcode then displays the following errors: Xcode 然后显示以下错误:

Error 4 Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee7ce5ff8) in ios\.symlinks\plugins\livechatt\ios\classes\LiveChatPlugin.m错误 4 Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee7ce5ff8) in ios\.symlinks\plugins\livechatt\ios\classes\LiveChatPlugin.m

#import "LivechatPlugin.h"
#if __has_include(<livechat/livechat-Swift.h>)
#import <livechat/livechat-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "livechat-Swift.h"
#endif

@implementation LivechatPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar { <-- ERROR HERE
    [LivechatPlugin registerWithRegistrar:registrar];
}
@end

Errors 5-1000, 173400-174359 Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee7ce5ff8) in ios\.symlinks\plugins\livechatt\ios\classes\LiveChatPlugin.m错误 5-1000、173400-174359 Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee7ce5ff8)ios\.symlinks\plugins\livechatt\ios\classes\LiveChatPlugin.m

#import "LivechatPlugin.h"
#if __has_include(<livechat/livechat-Swift.h>)
#import <livechat/livechat-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "livechat-Swift.h"
#endif

@implementation LivechatPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
    [LivechatPlugin registerWithRegistrar:registrar]; <-- ERROR HERE
}
@end

Error 174360 Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee7ce5ff8) in Runner\GeneratedPluginRegistrant.m错误 174360 线程 1: Runner\GeneratedPluginRegistrant.m中的Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee7ce5ff8)

/* previous code ommitted for brevity */
@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
  [AppAvailability registerWithRegistrar:[registry registrarForPlugin:@"AppAvailability"]];
  [FlutterLocalNotificationsPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterLocalNotificationsPlugin"]];
  [FLTGoogleMapsPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTGoogleMapsPlugin"]];
  [LivechatPlugin registerWithRegistrar:[registry registrarForPlugin:@"LivechatPlugin"]]; <-- ERROR HERE
  [LocationPlugin registerWithRegistrar:[registry registrarForPlugin:@"LocationPlugin"]];
  [MsalMobilePlugin registerWithRegistrar:[registry registrarForPlugin:@"MsalMobilePlugin"]];
  [FLTPathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTPathProviderPlugin"]];
  [FLTSharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTSharedPreferencesPlugin"]];
  [SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];
  [FLTURLLauncherPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTURLLauncherPlugin"]];
  [FLTWebViewFlutterPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTWebViewFlutterPlugin"]];
}

@end

Could I have some help diagnosing the reason that this error is being thrown in these places, and why it is only affecting the livechatt plugin?我可以帮助诊断在这些地方抛出此错误的原因,以及为什么它只影响 livechatt 插件吗? Thank you!谢谢!

I am the author of the said package. The issue has been fixed in the latest release.我是上述 package 的作者。该问题已在最新版本中修复。 Kindly update the package in your pubspec.yaml请更新 pubspec.yaml 中的 package

dependencies:
  livechatt: "^1.1.0" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM