当我向后端发送内容时,尝试使用解析 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/