【发布时间】:2021-05-19 12:38:42
【问题描述】:
我一直在尝试在我的 Flutter 应用程序中使用位于 https://pub.dev/packages/livechatt 的插件“livechat”。让它在 Android 版本中运行没有问题,但在 iOS 上,它每次都以相同的方式失败。
我在pubspec.yaml 中导入了这个包,就像我使用其他插件一样。从 Android Studio 在 iOS 模拟器中运行应用程序时,构建成功,但应用程序在启动后立即崩溃。从 Xcode 运行应用程序时,构建成功,但应用程序在启动启动屏幕上冻结。
注意:就目前而言,该插件在 iOS 中的依赖项确实存在错误,因此那些测试它的人需要在livechatt.podspec 中将目标操作系统从 iOS 9.0 更改为 iOS 11.0,然后运行 @ 987654324@在项目的iOS目录中同步更改
Xcode 然后显示以下错误:
错误 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
错误 5-1000、173400-174359
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 {
[LivechatPlugin registerWithRegistrar:registrar]; <-- ERROR HERE
}
@end
Runner\GeneratedPluginRegistrant.m 中的错误 174360 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
我能否帮助诊断在这些地方引发此错误的原因,以及为什么它只影响 livechat 插件?谢谢!
【问题讨论】:
标签: ios objective-c xcode flutter flutter-dependencies