【问题标题】:Parse geopoint swift not getting current location快速解析地理点未获取当前位置
【发布时间】:2014-08-07 02:43:25
【问题描述】:

当我向后端发送内容时,尝试使用解析 PFGeoPoint.geoPointForCurrentLocationInBackground 获取当前位置。代码看起来像

NSLog("Before block")
    PFGeoPoint.geoPointForCurrentLocationInBackground {
        (geoPoint: PFGeoPoint!, error: NSError!) -> Void in
        NSLog("inside block")
        if !error {
            // do something with the new geoPoint
        }
    }

而且我从来没有在控制台上得到我的内部块。我安装了核心位置框架,它允许我做类似的事情

let point = PFGeoPoint(latitude:40.0, longitude:-30.0)

如果有帮助,我在进行上述通话时不会被要求提供用户位置。

【问题讨论】:

    标签: ios swift parse-platform geopoints


    【解决方案1】:
     NSLocationWhenInUseUsageDescription
    

    NSLocationAlwaysUsageDescription
    

    把这个键放在 info.plist 中

    【讨论】:

      【解决方案2】:

      我在目标 c 中遇到了类似的问题。我将此密钥放在了我的 info.plist 中

      NSLocationWhenInUseUsageDescription

      在没有那个键的情况下,它在 iOS 7 中运行良好,但在 8 中就不行了。

      当 8 出来时,Parse 很可能会处理这种情况。

      【讨论】:

      • 您还需要请求授权以及核心位置以触发 UINotification。
      猜你喜欢
      • 1970-01-01
      • 2019-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多