微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.jb51.cc/swift/318704.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐