【问题标题】:Not updating the current location in MKMapView不更新 MKMapView 中的当前位置
【发布时间】:2010-12-02 11:42:33
【问题描述】:

我正在使用 CLLocationManager 更新当前位置,但有时当前位置会丢失。我不知道为什么当前位置会丢失。

请帮我解决这个问题。

谢谢你, 马丹·莫汉

【问题讨论】:

    标签: iphone objective-c cllocationmanager


    【解决方案1】:

    位置可能会由于多种原因而丢失:

    • 设备不再有合理开放的天空访问权限,因此 GPS 卫星信息不可用。

    • 没有足够的蜂窝塔可用于执行三角测量。

    • wifi 接入点不在已知接入点的数据库中。

    • 用户切换到飞行模式。

    还有更多。位置感知应用程序必须假设它们随时会丢失地理位置信息。它通常会在片刻之后再次出现。

    【讨论】:

      【解决方案2】:

      如果您没有获得任何有关您的位置的更新,那么可能会调用此代表

      - (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.
       }
      

      你可以找出问题所在。

      【讨论】:

        猜你喜欢
        • 2014-10-16
        • 1970-01-01
        • 1970-01-01
        • 2012-09-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-11
        • 2011-09-18
        相关资源
        最近更新 更多