NativeScript / nativescript-geolocation

Geolocation plugin to use for getting current location, monitor movement, etc
Apache License 2.0
139 stars 76 forks source link

Performing enableLocationRequest always hangs forever on iOS 12.X #227

Closed crowmagnumb closed 5 years ago

crowmagnumb commented 5 years ago

Which platform(s) does your issue occur on?

iOS devices and emulators running 12.X

iPad Pro: iOS 12.2 iPhone 7: iOS 12.3.1 emulator iPhone Xs: iOS 12.1

I do not experience the problem on an iPhone 5s: iOS 9.3.2

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

Simply put the following code never resolves on iOS 12.X. The promise is neither resolved nor rejected.

import * as geolocation from "nativescript-geolocation";

...

geolocation.enableLocationRequest(true, true)
 .then(() => {
     console.log("User Enabled Location Service");
})
.catch(ex => {
    console.log("Unable to Enable Location", ex);
});
elena-p commented 5 years ago

Hi @crowmagnumb,

We recently released {N} 6.0, plugin demo apps are updated and enableLocationRequest works as expected on iOS 12. Could you try updating to the latest version (or at least 5.4 if you are not ready to switch to the new bundle workflow) and check whether the issue happens on your side?

dbfannin commented 5 years ago

I would really appreciate some help. i'm new to {n} and I'm running into this same issue. I have a bare bones Angular app. all it is trying to do is to get my location, but enableLocationRequest never resolved. It doesn't hit the then or the catch. I'm on mac using simulator iOS 12.4.

"nativescript-angular": "~8.2.0",
"nativescript-geolocation": "^5.1.0",
"nativescript-theme-core": "~1.0.4",
"tns-core-modules": "~6.0.0",
"nativescript-dev-webpack": "~1.0.0",

Are there any known issues or workarounds for getting this to work? Any help would be greatly appreciated!

crowmagnumb commented 5 years ago

Yeah, sorry @elena-p but I have upgraded now and like @dbfannin I still have the same issue. (Note I have only tried it so far on the simulator). I have nativescript-angular version 8.0.2 and nativescript-geolocation 5.1.0.

elena-p commented 5 years ago

Hi @crowmagnumb, @dbfannin,

When you use enableLocationRequest with always option set to true, you need to add NSLocationAlwaysAndWhenInUseUsageDescription key in your app's Info.plist. You could refer to the method's description in the README.

We just updated all demo apps to use enableLocationRequest(true, true) with both options enabled.

dbfannin commented 5 years ago

@elena-p Thanks for the reply! i'll give it a shot and see if that works. Thanks to everyone for the awesome plugin!