# GeoLocation not properly asking for permissions on iOS

**URL:** <https://forums.fusetools.com/t/geolocation-not-properly-asking-for-permissions-on-ios/4958>\
**Category:** Bug Reports\
**Created:** [September 1, 2017, 4:58pm UTC](https://forums.fusetools.com/t/geolocation-not-properly-asking-for-permissions-on-ios/4958 "2017-09-01T16:58:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krister](https://avatars.discourse-cdn.com/v4/letter/k/f9ae1b/32.png) [@krister](https://forums.fusetools.com/u/krister)\
**Post date:** [September 1, 2017, 4:58pm UTC](https://forums.fusetools.com/t/geolocation-not-properly-asking-for-permissions-on-ios/4958/1 "2017-09-01T16:58:02Z")

</div>

**Operating system** Windows and macOS (Fuse version 1.2.1 on both)

It seems like `GeoLocation.getLocation()` isn’t working properly when executed on iOS. I am using the example from [the documentation](https://www.fusetools.com/docs/fuse/geolocation/geolocation) as example.

_ **Expected behaviour** _

(On both Android and iOS)

- `GeoLocation.getLocation()` is triggered in code at app-launch.
- App will ask for permission to use location at app launch.
- User accepts the permission.
- Timeout-location text is filled in the app.
- User clicks “Start Continous listener”-button
- Continous listener starts and app detects changes and fills the Continous text.

_ **Experienced behaviour** _

(Android)

- Same as expected

(iOS)

- `GeoLocation.getLocation()` is triggered in code at app-launch.
- Nothing happens in the app.
- User clicks “Start Continous listener”-button
- NOW user is asked for permission to use location.
- Continous listener starts and app detects changes and fills the Continous text.

**Example code added for convienience. Practically identical to example-code in [the documentation](https://www.fusetools.com/docs/fuse/geolocation/geolocation) .**

```auto
<App>
  <JavaScript>
    var Observable = require("FuseJS/Observable");
    var GeoLocation = require("FuseJS/GeoLocation");

    // Immediate
    var immediateLocation = JSON.stringify(GeoLocation.location);

    // Timeout
    var timeoutLocation = Observable("");
    var timeoutMs = 5000;
    GeoLocation.getLocation(timeoutMs).then(function(location) {
        timeoutLocation.value = JSON.stringify(location);
    }).catch(function(fail) {
        console.log("getLocation fail " + fail);
    });

    // Continuous
    var continuousLocation = GeoLocation.observe("changed").map(JSON.stringify);

    GeoLocation.on("error", function(fail) {
        console.log("GeoLocation error " + fail);
    });

    function startContinuousListener() {
        var intervalMs = 1000;
        var desiredAccuracyInMeters = 10;
        GeoLocation.startListening(intervalMs, desiredAccuracyInMeters);
    }

    function stopContinuousListener() {
        GeoLocation.stopListening();
    }

    module.exports = {
        immediateLocation: immediateLocation,
        timeoutLocation: timeoutLocation,
        continuousLocation: continuousLocation,

        startContinuousListener: startContinuousListener,
        stopContinuousListener: stopContinuousListener
    };
</JavaScript>

<StackPanel>
    <Text>Immediate:</Text>
    <Text Value="{immediateLocation}" />

    <Text>Timeout:</Text>
    <Text Value="{timeoutLocation}" />

    <Text>Continuous:</Text>
    <Text Value="{continuousLocation}" />

    <Button Text="Start continuous listener" Clicked="{startContinuousListener}" />
    <Button Text="Stop continuous listener" Clicked="{stopContinuousListener}" />
</StackPanel>
</App>

```

```auto
{
  "RootNamespace":"",
  "Packages": [
    "Fuse",
    "FuseJS",
    "Fuse.GeoLocation"
  ],
  "Includes": [
    "*"
  ]
}

```

It was also discovered trough discussion on Slack that your [example-project on git](https://github.com/fusetools/fuse-samples/tree/master/Samples/GeoLocation) is outdated. I would reccomend removing git-examples and only refer to documentation-exampels or visa versa.

I also find it wierd that the permission-dialoge pops up when you click the start button, but if you attempt to execute the very same function in code nothing happens…

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [September 4, 2017, 8:54am UTC](https://forums.fusetools.com/t/geolocation-not-properly-asking-for-permissions-on-ios/4958/2 "2017-09-04T08:54:19Z")

</div>

Thanks for reporting! I’ve logged [a ticket](https://github.com/fusetools/fuselibs-public/issues/427) and you can follow its status there.

---

<div class="post-metadata">

**Author:** ![Alexey\_Buzdin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/alexey_buzdin/32/643_2.png) [@Alexey\_Buzdin](https://forums.fusetools.com/u/Alexey_Buzdin)\
**Post date:** [September 22, 2017, 11:21am UTC](https://forums.fusetools.com/t/geolocation-not-properly-asking-for-permissions-on-ios/4958/3 "2017-09-22T11:21:39Z")

</div>

Hi @krister we’ve Closed [the ticket](https://github.com/fusetools/fuselibs-public/issues/427) and merged the fix to master on our GitHub
