bkonyi / FlutterGeofencing

Rough work for Flutter geofencing plugin
BSD 3-Clause "New" or "Revised" License
338 stars 219 forks source link

Example app: on IOS: uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins' #38

Open AlexanderUsselmann opened 4 years ago

AlexanderUsselmann commented 4 years ago

Running the example code in IOS result in a crash on startup with the following error message: flutter: Initializing..

*** Assertion failure in -[GeofencingPlugin startGeofencingService:], /Users/xxx/flutter/.pub-cache/hosted/pub.dartlang.org/geofencing-0.0.1/ios/Classes/GeofencingPlugin.m:164

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins'

using pubspec.yaml entry:

geofencing: ^0.0.1

I would be very pleased about some help or a idea for a possible solution

braysonjohn148 commented 4 years ago

So for those who couldn't solve this, running on C not swift, your AppDelegate.m

include "AppDelegate.h"

include "GeneratedPluginRegistrant.h"

include "FlutterDownloaderPlugin.h"

@implementation AppDelegate

void registerPlugins(NSObject* registry) { // [GeneratedPluginRegistrant registerWithRegistry:registry]; [FlutterDownloaderPlugin registerWithRegistrar:[registry registrarForPlugin:@"vn.hunghd.flutter_downloader"]]; }

@end

copy that and paste it

bkonyi commented 4 years ago

To be clear, geofencing ^0.0.1 is not up to date with this repository. I wasn't intending on officially publishing this plugin as the Flutter plugins team didn't have the bandwidth to support it, so it appears that some individuals decided to publish it themselves. If you want to use this plugin as-is, your best bet is to pull it in with a local copy or a git dependency in your pubspec.yaml.

GJDK commented 4 years ago

Is this plugin using Flutter downloader plugin?

sanjubhatt2010 commented 3 years ago

I got same error and resoled the crash by following code

override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        GeneratedPluginRegistrant.register(with: self)
        GeofencingPlugin.setPluginRegistrantCallback({_ in
        })
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }