Parse.com PFGeoPoint.geoPointForCurrentLocationInBackground 没有做任何事情 [英] Parse.com PFGeoPoint.geoPointForCurrentLocationInBackground not doing anything
本文介绍了Parse.com PFGeoPoint.geoPointForCurrentLocationInBackground 没有做任何事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是 Parse.com iOS SDK,我需要用户的当前位置,所以我使用的是函数 PFGeoPoint.geoPointForCurrentLocationInBackground(...).
I'm using Parse.com iOS SDK, and I need the current location of the user, so I'm using the function PFGeoPoint.geoPointForCurrentLocationInBackground(...).
问题是:参数列表中的块从未被调用.这是我的代码:
The problem is: the block in the argument list is never called. Here is my code:
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 中修复.
I had the same problem. It's fixed in Parse 1.4.0.
此外,您还需要将以下键/值对添加到您应用的 info.plist 中:
Also you need to add the following key/value pair to your app's 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.com PFGeoPoint.geoPointForCurrentLocationInBackground 没有做任何事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文