Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

getCurrentLocation does not fetch location on ios (below 13 version) #522

Closed
1 task
razmik-gharibyan opened this issue Sep 11, 2020 · 20 comments
Closed
1 task
Labels
platform: ios Issue is related to the iOS platform status: triage Indicates that this issue needs to be analyzed and decorated with the appropriate labels

Comments

@razmik-gharibyan
Copy link

馃悰 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:

  • [ +] 馃摫 iOS
  • 馃 Android
@SergejDK
Copy link

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

@mvanbeusekom
Copy link
Member

@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.

@mvanbeusekom mvanbeusekom added platform: ios Issue is related to the iOS platform status: needs more info We need more information before we can continue work on this issue. labels Sep 18, 2020
@razmik-gharibyan
Copy link
Author

razmik-gharibyan commented Sep 19, 2020

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.

@mvanbeusekom
Copy link
Member

Which accuracy do you use when getting the location?

@razmik-gharibyan
Copy link
Author

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

@SergejDK
Copy link

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

@razmik-gharibyan
Copy link
Author

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

@rlueders
Copy link

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.

@DonC83
Copy link

DonC83 commented Sep 24, 2020

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

@kightsonsanom
Copy link

kightsonsanom commented Sep 25, 2020

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

@racacere
Copy link

Same here on both platforms and multiple devices

@jimmyszeles
Copy link

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.

@kightsonsanom
Copy link

kightsonsanom commented Sep 27, 2020

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

@kightsonsanom
Copy link

@mvanbeusekom should I create a separate issue for Android ?

@mvanbeusekom
Copy link
Member

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

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

@hectorAguero
Copy link

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?

@nagarwal8
Copy link

nagarwal8 commented Oct 10, 2020

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

@gabrielgarciagava
Copy link

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?

@mvanbeusekom mvanbeusekom added status: triage Indicates that this issue needs to be analyzed and decorated with the appropriate labels and removed status: needs more info We need more information before we can continue work on this issue. labels Oct 29, 2020
@aquilarafa
Copy link

@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

@mvanbeusekom
Copy link
Member

This issue should have been solved since version 6.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ios Issue is related to the iOS platform status: triage Indicates that this issue needs to be analyzed and decorated with the appropriate labels
Projects
None yet
Development

No branches or pull requests