geofire-objc
geofire-objc copied to clipboard
geoFire setLocation method does not save location to Firebase Database - Swift 3
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
Are you getting an error, or is it failing silently?