开发者

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜