Madan Mohan
Madan Mohan

Reputation: 8820

Not updating the current location in MKMapView

I am using CLLocationManager to update the current location but some times the current location is lost. I don't know why the current location is losing.

Please help me out of this.

Thank you, Madan Mohan

Upvotes: 1

Views: 741

Answers (2)

ipraba
ipraba

Reputation: 16553

If you didnt get any update on your location then this delegate might be called

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error 
{
switch([error code])
{
   case kCLErrorLocationUnknown: 
   //The location manager was unable to obtain a location value right now

   case kCLErrorDenied: 
   //Access to the location service was denied by the user

   case kCLErrorNetwork: 
   //The network was unavailable or a network error occurred.

   case kCLErrorHeadingFailure:
   // The heading could not be determined.
 }

You can find out whats the problem is.

Upvotes: 2

Matthew Frederick
Matthew Frederick

Reputation: 22305

The location can become lost for a wide variety of reasons:

  • The device no longer has reasonably open access to the sky so GPS satellite information is unavailable.

  • There aren't enough cell towers available to perform triangulation.

  • The wifi access point isn't in the database of known access points.

  • The user switched to Airplane Mode.

And many more. Location-aware applications have to assume they'll lose geolocation information at any time. It often comes back moments later.

Upvotes: 2

Related Questions