Not updating the current location in MKMapView

天大地大妈咪最大 提交于 2020-01-03 02:50:11

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4334565/not-updating-the-current-location-in-mkmapview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!