geofire-objc icon indicating copy to clipboard operation
geofire-objc copied to clipboard

geoFire setLocation method does not save location to Firebase Database - Swift 3

Open benmak11 opened this issue 7 years ago • 1 comments

Hi,

I am working in Xcode 8.3.2 with the latest swift release (Swift 3). I have been using the setLocation method for saving my current location in my firebase database. Is there something wrong with this code block:

func updateUserLocation() {
    let userID = FIRAuth.auth()!.currentUser!.uid
    print("BEN --- Current user ID: \(userID)")
    geoFire!.setLocation(currentLocation, forKey: userID){ (error) in
        if(error != nil){
            print("BEN: --- An error occured: \(String(describing: error))")
        } else {
            print("Ben ---- Saved location")
        }
    }
}

Or am I missing something? Your help would be greatly appreciated.

Thanks

benmak11 avatar May 01 '17 18:05 benmak11

Are you getting an error, or is it failing silently?

morganchen12 avatar Jun 20 '19 17:06 morganchen12