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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: System.TimeoutException: 'Could not retrieve latest GPS coordinates to be able to determine geofence current state' for iOS #1544

Open
6 of 10 tasks
hannerygge opened this issue Dec 19, 2024 · 7 comments
Labels
bug Something isn't working unverified This issue has not been verified by a maintainer

Comments

@hannerygge
Copy link

Component/Nuget

GPS or Geofencing (Shiny.Locations)

What operating system(s) are effected?

  • iOS (13+ supported)
  • Mac Catalyst
  • Android (8+ supported)

Version(s) of Operation Systems

iOS 15, iOS 18

Hosting Model

  • MAUI
  • Native/Classic Xamarin
  • Manual

Steps To Reproduce

  1. Create a new project with the Shiny template in Visual Studio with Geofencing

  2. Add new geofence

  3. Request state of geofence

Expected Behavior

Expected behavior is for this to show if the phone is inside or outside the monitored geofence.

Actual Behavior

This results in an exception: System.TimeoutException: 'Could not retrieve latest GPS coordinates to be able to determine geofence current state' when running on iOS.

Exception or Log output

System.TimeoutException: 'Could not retrieve latest GPS coordinates to be able to determine geofence current state'

Code Sample

https://github.com/hannerygge/Project2

Code of Conduct

  • I have supplied a reproducible sample that is NOT FROM THE SHINY SAMPLES!
  • I am a Sponsor OR I am using the LATEST stable/beta version from nuget (v3.0 stable - ALPHAS are not taking issues - Sponsors can still send v2 issues)
  • I am Sponsor OR My GitHub account is 30+ days old
  • I understand that if I am checking these boxes and I am not actually following what they are saying, I will be removed from this repository!
@hannerygge hannerygge added bug Something isn't working unverified This issue has not been verified by a maintainer labels Dec 19, 2024
@aritchie
Copy link
Member

This isn't a bug. That call times out after 20 seconds of waiting for the GPS reply. If the GPS can't get a fix, this will happen. You can see the code here:

public async Task<GeofenceState> RequestState(GeofenceRegion region, CancellationToken cancelToken = default)

I could extend the timeout or base it completely off the cancellation token if you think that would help!?

@hannerygge
Copy link
Author

I have tried this with multiple different devices running different versions of iOS, and multiple apps I have created, and I get this exception with all of them, none of them can get a GPS fix. When using different methods for getting the GPS position of the device, there is no problem getting coordinates. I have not seen this problem with Android, only iOS.

@alexen80
Copy link

Also when viewing the source in Vs2022, it complains that CLCircularRegion is deprecated - https://developer.apple.com/documentation/corelocation/clcircularregion , but im not sure thats relevant here.

image

@aritchie
Copy link
Member

It's only recently been marked deprecated. I haven't updated to whatever the new mechanism is. It won't be required until iOS 19 likely.

@hannerygge
Copy link
Author

Also another note, since it can't get the GPS fix, the geofencing is also not working, OnStatusChanged is never triggered even though the geofence shows up in the list for monitored regions.

@aritchie
Copy link
Member

Also another note, since it can't get the GPS fix, the geofencing is also not working, OnStatusChanged is never triggered even though the geofence shows up in the list for monitored regions.

Getting the current status of the geofence doesn't have anything to do with the delegate firing. I'm running geofencing on iOS without issues right now. What is your test case? Are you testing in sim? Are you actually testing with a device?

@hannerygge
Copy link
Author

hannerygge commented Dec 20, 2024

I am testing on a device.
I have tested the same code on an Android device and an iOS device, and Android works great, but not iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified This issue has not been verified by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants