For context I work on an app that requires authorizedAlways
permission. Since the release of iOS 13 we have noticed that ~3-4% of our users are receiving location updates (from didUpdateLocations
) that have a coordinate of 0,0
and a horizontalAccuracy
of 2500. This seems to only be happening while the app is in a background state.
This is all very confusing given that the app logs all changes to authorization status (using didChangeAuthorization
) and at no point do I see any change to a value other than authorizedAlways
. That said, based on manual testing I've done it does seem that the app will be notified of a change to authorizedAlways
status after a user hits the initial requestAlwaysAuthorization
prompt with Allow While Using App
. Then when the user backgrounds the app for a little while they are reprompted with two options, Keep Only While Using
or Change to Always Allow
. The app seems to only get notified of an authorization status change if the user proceeds with Keep Only While Using
selection (and the app is notified of a change to authorizedWhenInUse
.)
I had a hypothesis that there might be some weird state between the user being prompted for the background use (or the OS determining a prompt is required) and the user actually responding to the prompt, but my testing has pretty consistently shown that in that state the app is simply not receiving any location updates.
I've hit a wall on troubleshooting this and am hoping its just an iOS 13 bug but I've yet to hear of any other apps experiencing this issue. Would greatly appreciate any suggestions on further troubleshooting ideas or simply that your app has experienced this issue as well so I can stop banging my head on it!
It's possible that a setting has changed and needs to be corrected before you can also fix your incorrect iPhone location. Thankfully, you can reset all of your Location Services settings. Just open Settings and tap General -> Reset -> Reset Location & Privacy.
Typically, your iPhone's location will be accurate within 15-20 feet. This exact number can vary depending on what method your iPhone is using to estimate its location, as well as the signal the device is able to achieve. With a weak signal to GPS and the internet, the accuracy of your phone's location will diminish.
Here's how: Go to Settings > Privacy, then select Location Services. Select an app, then turn Precise Location on or off.
This sounds like a bug. If the location is invalid it should have a negative value for horizontalAccuracy
but this is definitely an invalid location. Run the CLLocationCoordinate2D
through CLLocationCoordinate2DIsValid()
or compare it to kCLLocationCoordinate2DInvalid
but since you have a positive horizontal accuracy it will probably tell you (incorrectly) that it's valid.
My guess is the same as yours, that the app has been told it has "Always" permission before the user has actually granted Always from the second prompt and it's somehow receiving bad locations when in the background.
There's no notification because your app is never supposed to know when it actually has Always permission (presumably to prevent it from waiting until it has Always to start abusing background location).
Either file a bug with Apple or use a DTS incident. If it's a framework bug you should be re-credited your DTS and get faster support at the same time.
In the meantime, add extra checks for invalid locations that include the coordinate being 0,0
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With