解析geopoint swift未获取当前位置 [英] Parse geopoint swift not getting current location

查看:87
本文介绍了解析geopoint swift未获取当前位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

trying to use parses PFGeoPoint.geoPointForCurrentLocationInBackground to get current location when i send something to my backend. The code looks like

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

,我从没在控制台上弄过我的内幕.我已经安装了Core Locations Framework,它可以让我做类似的事情

and I never get my inside block on the console. I have Core Locations Framework installed and it allows me to do something like

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

如果有帮助,在进行上述致电时,系统不会要求我提供用户位置.

If it helps i am not being requested for user location when I do the call above.

推荐答案

 NSLocationWhenInUseUsageDescription

NSLocationAlwaysUsageDescription

将此键放入info.plist

Put this keys in the info.plist

这篇关于解析geopoint swift未获取当前位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆