我正在使用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中修复.
原文链接:https://www.f2er.com/swift/318704.html您还需要将以下键/值对添加到应用的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