getLocation crash

Hi,

to get the location i have the following code:

  if (geoLocation.location) {

      // I ALREADY HAVE LOCATION

    doWhatever(geoLocation.location);

  } else {

        //WE SHOULD REQUEST THE LOCATION

      var timeout = 4000;
      geoLocation.getLocation(timeout).then(function(location) {

          doWhatever(location);

      }, function() {

          //ERROR GETING LOCATION

      });  

  }

and it works great…

BUUUUT then i wanted to ALWAYS request for the location (so just removing the “if (geoLocation.location)”) and then i get a crash (not always).

I would say that it seems to crash when requesting for the location while there is another location request from the same app…

Fuse 0.21

iOS 9.3.2 on iPhone 5

This sounds like a bug. I’ve filed a bug internally.

This api should be reduced to just getLocation and if the location is already given then just resolve the promise, instead of having to check for the geoLocation.location

i don’t agree… sometimes u want to request for the location even having one “on cache”… it’s way better to be able to control by code when do u want to force the “getLocation”

Then do getLocation without parameters will only get the location once, and passing the timeout paramter would keep updating it. Keeps the API simple and consistent

Hey Zaulin,

This should be fixed internally and the changes will be included in a future version of Fuse. Keep a lookout for changelog entries relating to GeoLocation. :slight_smile:

Hi… as far as i see… not in 0.25 :slight_smile:

Yeah, it takes a little longer for changes to percolate through our release procedure, testing and so on.

This is fixed for Android in Fuse 0.25.5, which you can get from https://www.fusetools.com/downloads.

Unfortunately, the fix for iOS won’t ship until Fuse 0.26, but that release is now going through testing, and will be available soon.

A pre release version of Fuse 0.26, which has several improvements to geolocation on ios, is now available on https://www.fusetools.com/downloads/channel/qa if you want to try it.