user6083214 user6083214 - 23 days ago 9
iOS Question

databaseRef Firebase withoud childByAutoID()

Guten Tag,
i'm uploading some text to firebase through my iOS Application, but i can't find a code, where i can give the App User not a random ID, but maybe the email for the id to upload or Name. I hope you understand what i mean.

Current Code:

let logininit : [String : AnyObject] = ["text4" : text4!, "text5" : text5!, "text6" : text6!]

let databaseRef = FIRDatabase.database().reference()

databaseRef.child("Logins").childByAutoId().setValue(logininit)


Now i want to remove this childByAutoID, and set it to, how i said, email or name of the user.

Firebase Database

EDIT

Resolved this Problem:
databaseRef.child("Logins").child(The Email That You Want Here).setValue(logininit)

Answer

I think I understood what you meant, but I don't see reasons for you to do that. Usually when you have a new entry on some entity, you usually gives it a unique ID (UUID). So, I think if you use child(The Email That You Want Here), should work as you want:

databaseRef.child("Logins").child(The Email That You Want Here).setValue(logininit)
Comments