gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 05:47:08 25 4
gpt4 key购买 nike

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

问题是:参数列表中的 block 从未被调用。这是我的代码:

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>

引用资料:

关于swift - Parse.com PFGeoPoint.geoPointForCurrentLocationInBackground 没有做任何事情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25441091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com