Parse and Swift Geopoints not saving

582 views Asked by At

I have tried everything. No matter what my Geopoints will not save when using an actual device with xcode or using the simulator.

if signUpError == nil {
   PFGeoPoint.geoPointForCurrentLocationInBackground {
   (geoPoint: PFGeoPoint?, error: NSError?) -> Void in
     if error == nil {
        PFUser.currentUser()!.setValue(geoPoint, forKey: "location")
      }
}

I am not sure what to do.

1

There are 1 answers

2
Icaro On BEST ANSWER

That is because you are setting it but you are not saving the value you just set:

if signUpError == nil {
   PFGeoPoint.geoPointForCurrentLocationInBackground {
   (geoPoint: PFGeoPoint?, error: NSError?) -> Void in
     if error == nil {
        PFUser.currentUser()!.setValue(geoPoint, forKey: "location")
        PFUser.currentUser().saveInBackground() 
      }
}