ios - How do I link each user to their data in Firebase for Swift 3? -


i have created project integrated firebase. has signup , login features. have personal information form fill individual users. when users different, data shown users. need show information related linked users. person should able access his/her database. couldn't find proper solution in swift 3.

from best can tell seems not referencing correct node in database. seeing of users data because variable messageref pointed @ /users. if you'd users see data need organize data when save messageitem is @ /users/{user_id}. access first getting user_id , reading it's new location (/users/{user_id}).

so i'd change these lines this:

override func viewdidload() {     super.viewdidload()         messageref = databaseref.child("users")      // additional setup after loading view. } 

to this:

override func viewdidload() {     super.viewdidload()        guard let user = auth.auth().currentuser else { return }        messageref = databaseref.child("users/\(user.uid)")     // additional setup after loading view. } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -