How to handle "Location Unknown"

Tometoyou

I have a Core Location Manager set up. Sometimes, when the phone is on 3G/4G signal it reports a LocationUnknown error in the didFailWithError function. Apple's documentation says that:

If the location service is unable to retrieve a location right away, it reports a kCLErrorLocationUnknown error and keeps trying. In such a situation, you can simply ignore the error and wait for a new event.

So I assume that the location manager is still trying to get the location at this point?

Now when I use the iPhone simulator and purposely give it no location, it also returns this LocationUnknown error. How can I know that the location can definitely not be retrieved, as opposed to just ignoring the error?

matt

As the documentation tells you, you have to keep trying. Actually, the location manager will do this for you. You ask it to start updating locations, and it just keeps sending you locations, of which the first one or two will always be "unknown". But usually, as the sensors warm up, you'll then start to get better and better location information. Typically you'll watch the time, so if you keep getting bad locations you can just time out after a certain amount of time has elapsed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related