Parse geopoint swift not getting current location
Asked Answered
K

2

4

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.

Klug answered 7/8, 2014 at 2:43 Comment(0)
R
1
 NSLocationWhenInUseUsageDescription

and

NSLocationAlwaysUsageDescription

Put this keys in the info.plist

Rafferty answered 28/11, 2014 at 14:46 Comment(0)
N
0

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.

Nels answered 4/9, 2014 at 21:10 Comment(1)
You will also need to request authorization as well with core location to trigger the UINotification.Nels

© 2022 - 2024 — McMap. All rights reserved.