I'm using the following Firebase Geofire method to set a user's location and save it to the database. The problem is that the location is written to the root of the database (database root/userID/location). Is there a way to change it so that it saves the location to root/users/userID/location?
geoFire.setLocation(CLLocation(latitude: locValue.latitude, longitude: locValue.longitude), forKey: userID) { (error) in
if (error != nil) {
print("An error occured: \(error)")
} else {
print("Saved location successfully!")
}
}
When I try to change forKey
to "/users/\(userID)"
I get an error stating that the key cannot contain special characters.
Thanks!