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

前端之家收集整理的这篇文章主要介绍了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

原文链接:https://www.f2er.com/swift/318704.html

猜你在找的Swift相关文章