ios - 快速解析地理点未获取当前位置

标签 ios swift parse-platform geopoints

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

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

而且我从来没有在控制台上得到我的内部 block 。我安装了 Core Locations Framework,它允许我做类似的事情

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

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

最佳答案

 NSLocationWhenInUseUsageDescription

NSLocationAlwaysUsageDescription

将这些键放入 info.plist

关于ios - 快速解析地理点未获取当前位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25173329/

相关文章:

ios - 从 iOS 中的主上下文重新加载私有(private)上下文

ios - 如何在 Swift 中将字典保存到核心数据

swift - 将带有 AM/PM 的字符串转换为 UserNotificationCenter 显示值

ios - 如何在 Swift 中将枚举和 switch() 与 UITableViewController 一起使用

javascript - 云代码函数运行两次

ios - 如何知道用户之前是否登录过?使用 parse.com

iphone - 如何在 iOS 中实现复制和粘贴功能

ios - 获取自定义 NS 对象的属性数组的简单方法?

ios - 防止重复使用的单元格中的按钮再次出现

ios - 通过 Parse.com 下载将 NSData 转换为 UIImage 时出现问题