Parse.com PFGeoPoint.geoPointForCurrentLocationInBackground does nothing

I use the Parse.com iOS SDK and I need the current location of the user, so I use the PFGeoPoint.geoPointForCurrentLocationInBackground (...) function.

The problem is this: 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 } } 

Any idea?

+8
ios8 swift
source share
3 answers

I had the same problem. It is fixed in Parse 1.4.0.

You also need to add the following key / value pair to your info.plist application:

 <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> 

Literature:

+17
source share

UPDATE:

Fixed


Facebook has returned on this issue.

Geopoint

A similar question is posted here: Parse geometoint swift does not get the current location

Will be updated as response.

+3
source share

Check this:

Click on project targets / create phases / Link binaries to libraries /

 This file must be listed: CoreLocation.framework if there is not click Add and select it from the list. 

In your ViewController.swift check this:

import CoreLocation

ViewController class: UIViewController, CLLocationManagerDelegate {

/ Supporting files /info.plist <- Click on this file

Press + to add: Key: NSLocationAlwaysUsageDescription Type: String Value: Add description

Press + to add: Key: NSLocationWhenInUseUsageDescription Type: String Value: Add description

check iOS Simulator / Debug / Location / Apple here you should select something (none => error)

0
source share

All Articles