-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geolocation error (kCLError Domain 0) on iOS when no WiFi networks are in range #9342
Comments
Does the same error show up at https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API/Using_the_Geolocation_API#examples ? |
No, on this page the correct lat/lon coordinates are displayed with no error messages when WiFi is disabled. |
I've been able to get a quick test of this on a Samsung Android 14 device, and with WiFi switched off geolocation worked without an error message with Leaflet 1.9.4. Seems like this issue might be limited to iOS devices. |
I notice the |
It's more like "need spare time and also an iPhone and an iMac which I don't have". @binghamchris By any chance would you be able to provide an error stack? Attach a desktop Safari as a debugger (and the works) in order to put breakpoints in the javascript code. The Leaflet geolocation code is pretty barebones and just calls the geolocation API a couple times. It's necessary to see how it runs compared to other geolocation examples. |
OK, I've had a go at this @IvanSanchez. Not being a JS developer I'm unsure if I've got the right info for you, so please let me know if there's more you need :) With WiFi switched off on the iPhone, I put a breakpoint on the When this stage is reached, which is right before the error message is displayed to the user on the iPhone, there's two things I notice:
Does this help please? |
Checklist
Steps to reproduce
This issue occurs naturally only in places where no WiFi networks are in range of your device. To reproduce this issue in places where there are WiFi networks, use the following steps:
Geolocation error: The operation couldn't be completed. (kCLErrorDomain error O.).
Note that the map is zoomed to the correct location as the error message is displayed. The location marker is also very briefly displayed on the map as the error message comes up.
I've found that this error occurs with
enableHighAccuracy
set to eithertrue
orfalse
, and withwatch
set to eithertrue
orfalse
.Expected behavior
When geolocation is used on an iOS device in areas where there are no WiFi networks, Leaflet should use the location provided by the device and not display an error message.
I'm afraid I don't have an Android device to test with to see if this issue occurs on other platforms.
Current behavior
Leaflet seems to be handling the geolocation returned by iOS when no WiFi networks are in range incorrectly. I base this on the fact that the map is zoomed to the correct bounds and the location maker is briefly displayed, indicating that Leaflet received a location and processed it correctly initially, and only after this throws an error.
I've tried to work out where in the code this is happening, without success I'm afraid.
For my project this is a very problematic issue as Paddel Buch is intended to support paddle sports participants on the Swiss lakes, and naturally you don't usually find WiFi networks in the middle of a lake!
Minimal example reproducing the issue
No response
Environment
The text was updated successfully, but these errors were encountered: