Firebase and Swift and I 'd come to inquire if there is some problem. So basically there are two things I want to do:
- Ask questions from my users and search only for a certain string in their name (or email address) And add them to an array.
- Find all your users and add them to an array.
The relevant portion of my data for this query looks like this:
as you can see, I am using Saidlagin of Fayrbej (Later I also want to add Facebook) and I can store its users by UID I am here.
One part of my rule file looks like this:
"registered_users": {".read": True, ".write": True, " .indexOn ": [" name "]}
So everyone should read and write access to this should have been part of my data.
I've read part of "recovery data" Fayrbej iOS guide on its website and in accordance with the Guide, the user name and must work my address to receive e-mail address at least I think so but it is not here is my code:
getUsersFromFirebase function () {go registeredUserRef = firebaseRef.childByAppendingPath ( "registered_users") registeredUserRef.queryOrderedByChild ( "name") observeSingleEventOfType (.Value, withBlock : {Snapshot in? If known as email = snapshot.value ["email"] String {println ( "\ (snapshot.key) Email: \ (email)")} If the name = snapshot.value [ "name"] as string? {Println ( "\ (snapshot.key) name : \ (name) ")}})}
I saw that firebase guides, they always utilize ChildAdded and value, but value for me makes more sense is. Output is nothing but the output and the child's output is only one user, i.e. which is currently logged.
So my questions are:
- Do I do it with my existing data structure or do I have to get rid of the story by the UID users?
- If yes, how do I have to change my code to do this work?
- If not, what would be the best way to store your users and possibly name inquiries?
- How can I query for example "hardworking" and only user get simple login: 1 (Max Masterman)?
I hope my description is detailed enough to help you thx in advance.
Supplement :
The weird thing is, that says "Guide to recover" data, it is possible that data from the query and sorting height.
Data:
Inquiry code:
And do not do that at all What i want to do