Search code examples
iosflutterbeacon

Flutter beacons_plugin - Unhandled Exception: MissingPluginException(No implementation found for method startMonitoring on channel beacons_plugin)


I've run into this situation: the plugin and my code ran perfectly in Android, but in iOS these errors happened:
(Screenshot - my reputation is too low to post images. For easy reading I took the screenshot of VSCode debug console; the errors were the same while run it from Xcode)

https://user-images.githubusercontent.com/10349431/94634472-b2d42e80-0302-11eb-9dc7-fa2956511b82.png

It shows in the debug screenshot above exceptions took place while invoking method startMonitoring, but after I commented related codes it turned into other methods (e.g. stopMonitoring, addRegion, etc).

(BTW, the error messages may be as many as hundreds of lines - in the screenshot above, there were actually 381 lines of total error messages.)

My environment:

MacOS 10.15.7
iOS 12.4.8 (iPad) 13.3 (iPhone)
Android 8.0.0
Xcode 12.0.1 (12A7300)
VSCode 1.49.2
Android Studio 4.0.1 with all SDK after Android 5.1 Lollipop

Thanks for any help!


Solution

  • I got it... In this case, BeaconsPlugin.listenToBeacons should not be placed below addRegion or startMonitoring/stopMonitoring. It should be in the first line of all actions of this plugin in the initPlatformState scope, just like it has been in the example.

    Sorry for dumb question.