Leaflet-locatecontrol plugin: ios app crash on motion and orientation popup permission

Hi, I am using this Leaflet plugin to allow users to use geolocalization on a map. It uses browser API such as motion and geolocalization. On the android app version, it works great, my code checks and requires geolocalization permission before setting the plugin using Capacitor. On the ios app version, the app checks as previous with Capacitor and it requires motion and orientation access showing a popup:


then the app crashes showing this exception:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Completion handler passed to -[CAPWebViewDelegationHandler webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:] was not called'
terminating with uncaught exception of type NSException

I tried looking for CAPWebViewDelegationHandler in the Capacitor XCode Pods Folder and on Capacitor Github, but nothing shows up.

I also tried requesting motion and orientation permission by using native API like:
which launched the same popup but this time no crash has been identified. Geolocation error shows up instead, which says that origin has no geolocation access.

My app info on XCode looks like this:

where I have added the privacy keys for motion and location description.

This is my Info.plist file:

I am using:

  • Capacitor 3.0.0
  • Ionic Framework 5
  • Leaflet 1.7.1
  • Leaflet.locatecontrol 0.73.0

I am new to ios development using ionic so if someone could give me some advice, it would be great.