juliuscanute / qr_code_scanner

QR Code Scanner for Flutter
BSD 2-Clause "Simplified" License
999 stars 759 forks source link

fix: Does not crash in debug mode of iOS 14+ #616

Closed tianxiawoyougood closed 1 year ago

tianxiawoyougood commented 1 year ago

In ios 14+, debug mode Flutter apps can only be launched from Flutter tooling, IDEs with Flutter plugins or from Xcode. So, registrar will be nil. However, we can't make it crash in its own plugin.

juliansteenbakker commented 1 year ago

Thank you for your contribution. I don't really understand the issue.

If i create a new flutter plugin with the official Flutter template, it generates the exact same registrar file as now present:

#import "Testplugin2Plugin.h"

#if __has_include(<testplugin2/testplugin2-Swift.h>)
#import <testplugin2/testplugin2-Swift.h>
#else
#import "testplugin2-Swift.h"
#endif

@implementation Testplugin2Plugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
  [SwiftTestplugin2Plugin registerWithRegistrar:registrar];
}
@end
tianxiawoyougood commented 1 year ago

Yes. However, it causes a crash. I submitted this issue to Flutter official. https://github.com/flutter/flutter/issues/115560#issuecomment-1336674541

juliansteenbakker commented 1 year ago

I'm first waiting for the answer on the official ticket before merging this.