Flutter-geolocator: getCurrentLocation does not fetch location on ios (below 13 version)

Created on 11 Sep 2020  ·  20Comments  ·  Source: Baseflow/flutter-geolocator

🐛 Bug Report

Geolocator getCurrentLocation() does not return value when i am using (simulator with ios version below 13).
No exceptions , no errors. I've treid adding breakpoint below line getCurrentLocation it seems like it's stuck in there.

Expected behavior

Reproduction steps

Configuration

For iOS version below 13.

Version: 6.0.0+4

Platform:

  • [ +] :iphone: iOS
  • [ ] :robot: Android
ios triage

Most helpful comment

getCurrentPosition() doesn't appear to be working, both on Android and iOS, seems to wait indefinitely. If I swap out getCurrentPosition with getLastKnownPosition it returns, however I'm not interested in the last known position.
Version is 6.0.0+4

All 20 comments

Do you have set a location on the simulators? One Time I forgot to activate location....

@razmik-gharibyan did do as @SergejDK mentioned and set a location for the simulator?

To do so use the following options: Features -> Location -> Custom Location. After that set a latitude and longitude and test getting the location again.

Yeah i have done it, but it's way too slow on ios versions below 13. Techically it returns value but it may take from 45 second to 2 minute to update location.

Which accuracy do you use when getting the location?

i've tried all, (low,medium,high,best)

@razmik-gharibyan did you try to use difference permissions? Sometimes it behaves differently with different permissions - just to narrow down the problem.

I've tried all kind of mix and match with allowAlways,allowWhenInUse,allowAlwaysAndWHenInUse. Same behaviour

Im seeing a similar issue, but on IOS 13 and 14. Prior to upgrading to version 6.x.x of the geolocator plugin, I was seeing positions updates every second or so when calling getPositionStream from my iphone 7 (physical device). However, after upgrading the plugin, I see only one or two updates, then nothing. Sometimes I never get any position updates, but when I do, it is seldom more than two or three. The couple position updates I do get usually have a position.accuracy of 4,000+. Not sure if this is different issue, or related to this one, but happy to open a new issue either way. I tried downgrading back to the old 5.x.x version of the plugin and everything works fine.

getCurrentPosition() doesn't appear to be working, both on Android and iOS, seems to wait indefinitely. If I swap out getCurrentPosition with getLastKnownPosition it returns, however I'm not interested in the last known position.
Version is 6.0.0+4

getCurrentPosition does not work for me as well. I have tried it on Android API30 Emulator and API29 real ONEPLUS 6. It just hangs indefinitely. I have tried all possible desiredAccuracies and isLocationEnabled returns true. So far I was using version 5.3.2+2 as a workaround but this version does not work on Android API 30 either

Same here on both platforms and multiple devices

I always had the iOS app crashing on me when using the getCurrentPosition function.
Found out that the key _EnableBackgroundLocationUpdates_ in _Info.plist_ made it crash for me.
Removed that key and now everything works fine for me, I had no trouble in Android tho.

@jimmyszeles what android versions, emulators/real devices did you try?

@mvanbeusekom should I create a separate issue for Android ?

@kightsonsanom yes please it would help to keep things apart.

Also if you have issues with Android I really recommend reading through issue #507. 

I always had the iOS app crashing on me when using the getCurrentPosition function.
Found out that the key _EnableBackgroundLocationUpdates_ in _Info.plist_ made it crash for me.
Removed that key and now everything works fine for me, I had no trouble in Android tho.

Thanks! I have that key and my app crashes on iOS 14 Emulator with current Flutter Stable, Beta and Master, and using Xcode 12, also the method getPositionStream crash the app, and like getCurrentPosition both not report the error in console.

That key does the same than enable background capabilities in xcode?

I have the same problem as mentioned in this thread - I cannot make it work on either iOS (SE 2nd generation) or Android (X) simulators. I am using "geolocator: ^6.0.0". The command "Position currentPosition =
await getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest);" hangs.

Any suggestions to make it work are appreciated

I always had the iOS app crashing on me when using the getCurrentPosition function.
Found out that the key _EnableBackgroundLocationUpdates_ in _Info.plist_ made it crash for me.
Removed that key and now everything works fine for me, I had no trouble in Android tho.

Do you mind sharing how did you find out that this was the problem?

@razmik-gharibyan did do as @SergejDK mentioned and set a location for the simulator?

To do so use the following options: Features -> Location -> Custom Location. After that set a latitude and longitude and test getting the location again.

It works for me.
Simulator ios 14.2

This issue should have been solved since version 6.1.2.

Was this page helpful?
0 / 5 - 0 ratings