繁体   English   中英

解析localoint swift没有获得当前位置

[英]Parse geopoint swift not getting current location

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

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,它允许我做类似的事情

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

如果在我上面的呼叫时,我没有被要求提供用户位置。

 NSLocationWhenInUseUsageDescription

NSLocationAlwaysUsageDescription

将此键放在info.plist中

我在目标c中遇到了类似的问题。 我把这把钥匙放在我的info.plist中

NSLocationWhenInUseUsageDescription

它在没有那个密钥的iOS 7中运行良好,但在8中它不会。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM