Geolocation broken on iOS?

I’ve been struggling with this for a while now.

It started with this thread:
https://www.fusetools.com/community/forums/general/changing_location_in_ios_emulator_crashes_the_app?page=1&highlight=0a79d0b2-7740-4a24-8630-e266aa5bf02b#post-0a79d0b2-7740-4a24-8630-e266aa5bf02b

However, using the error method does not provide the geo location and the dot is not drawn on the map to show where you are.

Then I tried the immediate method:

		setInterval(function(){ 
			var immediateLocation = JSON.stringify(GeoLocation.location);
	        	console.log('GPS = ' + immediateLocation);
	        })
		}, 3000);

This displays the GPS location, but it’s always the same!
If I change the location using the debug tool on the emulator, the GPS location just stays the same.

So I can conclude Geolocation does not work on iOS, unless someone proves i’m wrong?

Btw, I think the culprit is the mapview component in addition with the Geolocation which causes the errors.

Hey again R0b0tn1k,

Please post full and minimal code that reproduces your problem, and describe the expected and actual behaviour. We are not aware of GeoLocation being broken on iOS.

To answer the specifics in your post: The "error" event does not provide a location, but is triggered when the native API signals an error. Use e.g. GeoLocation.on("changed", ...) to add a location update listener.

The location property is the last known location and is not updated if you’re not listening for location updates, so the expected behaviour of the code you posted is to always show the same location.
Use startListening to get location changes, both when using events and when using the location property.

Hope this helps!

Olle, tried to find you on Skype, I feel like a 5 min call will resolve a lot more than 2 days in here :slight_smile:

Anyhow…

Did some debugging, and can confirm:
Geolocation is working with the changed event.
I put a text field that displays an observable with the location, and it updates when it’s changed.

So it’s not a bug on iOS, just a lack of debugging on my end. I owe someone there a beer.

Now, the issue that made me believe there’s a bug is:
Cannot display my location on the map.

Looking at the docs, i need to use:

ShowMyLocation : bool

but if I do that, nothing happens?

				        	<Select Data="{mapLocation}">
				            <MapView Latitude="41.9964600" Longitude="21.4314100" Zoom="10" ShowMyLocation="True" >
				                <Each Items="{locations}">
				                	<Each Items="{Locations}">
				                		<MapMarker Latitude="{lat}" Longitude="{lon}" Label="{Title}"/>
				                	</Each>
				                </Each>
				            </MapView>
				        </Select>

Once again, my apology for earlier claiming it’s a bug, but it would just not show the location on the map, making me believe it does not work.

Hi R0b0tn1k,

Fuse employees are not available for on-demand Skype support.

For the ShowMyLocation-problem, we do have an internal ticket raised and, judging from how it looks, this might already be fixed and will roll out in a future release of Fuse. For updates on that, watch this forum thread.

This thread will now be marked as resolved.