Parse geopoint swift not getting current location

╄→гoц情女王★ 提交于 2019-12-07 10:05:40

问题


trying to use parses PFGeoPoint.geoPointForCurrentLocationInBackground to get current location when i send something to my backend. The code looks like

NSLog("Before block")
    PFGeoPoint.geoPointForCurrentLocationInBackground {
        (geoPoint: PFGeoPoint!, error: NSError!) -> Void in
        NSLog("inside block")
        if !error {
            // do something with the new geoPoint
        }
    }

and I never get my inside block on the console. I have Core Locations Framework installed and it allows me to do something like

let point = PFGeoPoint(latitude:40.0, longitude:-30.0)

If it helps i am not being requested for user location when I do the call above.


回答1:


 NSLocationWhenInUseUsageDescription

and

NSLocationAlwaysUsageDescription

Put this keys in the info.plist




回答2:


I had a similar issue in objective c. I placed this key in my info.plist

NSLocationWhenInUseUsageDescription

It worked fine in iOS 7 without that key but in 8 it won't.

Parse will most likely handle this situation when 8 is out.



来源:https://stackoverflow.com/questions/25173329/parse-geopoint-swift-not-getting-current-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!