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

Bry*_*yan 8 parse-platform swift ios8

我正在使用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
    }
}
Run Code Online (Sandbox Code Playgroud)

任何的想法?

n13*_*n13 17

我有同样的问题.它已在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>
Run Code Online (Sandbox Code Playgroud)

参考文献:

  • 我认为这在他们的文档中会更加突出,因为如果没有这些,它将无法在iOS8中全部工作.非常感谢这个帖子! (3认同)