加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – Parse.com PFGeoPoint.geoPointForCurrentLocationInBa

发布时间:2020-12-14 05:40:06 所属栏目:百科 来源:网络整理
导读:我正在使用Parse.com iOS SDK,我需要用户的当前位置,所以我使用的功能是 PFGeoPoint.geoPointForCurrentLocationInBackground(…). 问题是:从不调用参数列表中的块.这是我的代码: PFGeoPoint.geoPointForCurrentLocationInBackground() { (point:PFGeoPoin
我正在使用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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读