swift – Parse.com PFGeoPoint.geoPointForCurrentLocationInBackground没有做任何事情

我正在使用Parse.com iOS SDK,我需要用户的当前位置,所以我使用的功能PFGeoPoint.geoPointForCurrentLocationInBackground(…).

问题是:从不调用参数列表中的块.这是我的代码

PFGeoPoint.geoPointForCurrentLocationInBackground() {
    (point:PFGeoPoint!,error:NSError!) -> Void in

    NSLog("Test log 1") // Never printed

    if point != nil {
        // Succeeding in getting current location
        NSLog("Got current location successfully") // never printed
        PFUser.currentUser().setValue(point,forKey: "location")
        PFUser.currentUser().saveInBackground()
    } else {
        // Failed to get location
        NSLog("Failed to get current location") // never printed
    }
}

任何的想法?

我有同样的问题.它已在Parse 1.4.0中修复.

您还需要将以下键/值对添加到应用的info.plist中:

<key>NSLocationWhenInUseUsageDescription</key>
<string>We want to send your location data to the NSA,please allow access to location services. (replace this text with whatever you want the dialog to say)</string>

参考文献:

> Parse SDK for iOS 8
> CLLocationManager in iOS 8 – use of NSLocationWhenInUseUsageDescription

相关文章

软件简介:蓝湖辅助工具,减少移动端开发中控件属性的复制和粘...
现实生活中,我们听到的声音都是时间连续的,我们称为这种信...
前言最近在B站上看到一个漂亮的仙女姐姐跳舞视频,循环看了亿...
【Android App】实战项目之仿抖音的短视频分享App(附源码和...
前言这一篇博客应该是我花时间最多的一次了,从2022年1月底至...
因为我既对接过session、cookie,也对接过JWT,今年因为工作...