Swift Firebase match UID keys with a array of UID strings The 2019 Stack Overflow Developer Survey Results Are InSwift for loop: for index, element in array?Swift Beta performance: sorting arraysSplit a String into an array in Swift?Swift Firebase - Array of items based on UIDFirebase iOS: createUserWithEmail isn't generating userId (uid)Firebase Swift .exist() not workingSwift Firebase access data inside child snapshot (by childAdded)Find Firebase Child from Array Values - xcode 8 / swift 3retrieve current user data from the firebaseHow can I save the amount of steps taken in a day to the firebase database?

Can an undergraduate be advised by a professor who is very far away?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

How do you keep chess fun when your opponent constantly beats you?

The difference between dialogue marks

If my opponent casts Ultimate Price on my Phantasmal Bear, can I save it by casting Snap or Curfew?

Button changing its text & action. Good or terrible?

Variable with quotation marks "$()"

Output the Arecibo Message

The phrase "to the numbers born"?

Is there a way to generate a uniformly distributed point on a sphere from a fixed amount of random real numbers?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

How to notate time signature switching consistently every measure

Why doesn't shell automatically fix "useless use of cat"?

How much of the clove should I use when using big garlic heads?

How to support a colleague who finds meetings extremely tiring?

What is preventing me from simply constructing a hash that's lower than the current target?

ELI5: Why they say that Israel would have been the fourth country to land a spacecraft on the Moon and why they call it low cost?

Correct punctuation for showing a character's confusion

What is this sharp, curved notch on my knife for?

Dropping list elements from nested list after evaluation

Are there any other methods to apply to solving simultaneous equations?

Short story: child made less intelligent and less attractive

How to quickly solve partial fractions equation?

If climate change impact can be observed in nature, has that had any effect on rural, i.e. farming community, perception of the scientific consensus?



Swift Firebase match UID keys with a array of UID strings



The 2019 Stack Overflow Developer Survey Results Are InSwift for loop: for index, element in array?Swift Beta performance: sorting arraysSplit a String into an array in Swift?Swift Firebase - Array of items based on UIDFirebase iOS: createUserWithEmail isn't generating userId (uid)Firebase Swift .exist() not workingSwift Firebase access data inside child snapshot (by childAdded)Find Firebase Child from Array Values - xcode 8 / swift 3retrieve current user data from the firebaseHow can I save the amount of steps taken in a day to the firebase database?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to figure out how I can match the Strings which are Firebase UID's in my "data" array with the keys that I am extracting from the firebase call. I need to match the Strings in the "data" array with "key" and then I will be able to manipulate the data how I want.



 var data = [String]()

Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")


)


enter image description here



enter image description here



My try, answer not in this code



 Database.database().reference().child("Businesses").observeSingleEvent(of: .value, with: snapshot in
self.businessUID = snapshot.value as? NSDictionary
if let dict = snapshot.value as? NSDictionary
for item in dict
let json = JSON(item.value)
let businessUid = json["uid"].stringValue
for uid in self.data
if uid == businessUid
Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")
if key == uid
print(key)
print("printing the matching keys here")



)
print(uid)
print("Printing the uids here")

Database.database().reference().child("Businesses").child(self.businessessuids).observe(.value, with: snapshot in
print(snapshot)
print(self.businessessuids)

)






)


UPDATE: Found matching values but cannot save



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.jsonKey
print(key)
//print(uid)
print("checking uid's")
//let name = user.childSnapshot(forPath: "name").value as! String
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("their_name")






)









share|improve this question
























  • Can you attach your Firebase table of allUsers ?

    – Amir Khan
    Mar 22 at 5:08











  • What is it that you want to see? All you would see if the parent "Businesses" then the UIDs then the data that uid's hold

    – Lukas Bimba
    Mar 22 at 5:11











  • Yes what allUsers contains ? more precisely, the structure of allUsers.

    – Amir Khan
    Mar 22 at 5:12











  • Just added it. Thats just a sample because it keeps going for a while lol

    – Lukas Bimba
    Mar 22 at 5:18











  • Got that. Thanks. Let me dig into this.

    – Amir Khan
    Mar 22 at 5:31

















0















I am trying to figure out how I can match the Strings which are Firebase UID's in my "data" array with the keys that I am extracting from the firebase call. I need to match the Strings in the "data" array with "key" and then I will be able to manipulate the data how I want.



 var data = [String]()

Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")


)


enter image description here



enter image description here



My try, answer not in this code



 Database.database().reference().child("Businesses").observeSingleEvent(of: .value, with: snapshot in
self.businessUID = snapshot.value as? NSDictionary
if let dict = snapshot.value as? NSDictionary
for item in dict
let json = JSON(item.value)
let businessUid = json["uid"].stringValue
for uid in self.data
if uid == businessUid
Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")
if key == uid
print(key)
print("printing the matching keys here")



)
print(uid)
print("Printing the uids here")

Database.database().reference().child("Businesses").child(self.businessessuids).observe(.value, with: snapshot in
print(snapshot)
print(self.businessessuids)

)






)


UPDATE: Found matching values but cannot save



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.jsonKey
print(key)
//print(uid)
print("checking uid's")
//let name = user.childSnapshot(forPath: "name").value as! String
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("their_name")






)









share|improve this question
























  • Can you attach your Firebase table of allUsers ?

    – Amir Khan
    Mar 22 at 5:08











  • What is it that you want to see? All you would see if the parent "Businesses" then the UIDs then the data that uid's hold

    – Lukas Bimba
    Mar 22 at 5:11











  • Yes what allUsers contains ? more precisely, the structure of allUsers.

    – Amir Khan
    Mar 22 at 5:12











  • Just added it. Thats just a sample because it keeps going for a while lol

    – Lukas Bimba
    Mar 22 at 5:18











  • Got that. Thanks. Let me dig into this.

    – Amir Khan
    Mar 22 at 5:31













0












0








0








I am trying to figure out how I can match the Strings which are Firebase UID's in my "data" array with the keys that I am extracting from the firebase call. I need to match the Strings in the "data" array with "key" and then I will be able to manipulate the data how I want.



 var data = [String]()

Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")


)


enter image description here



enter image description here



My try, answer not in this code



 Database.database().reference().child("Businesses").observeSingleEvent(of: .value, with: snapshot in
self.businessUID = snapshot.value as? NSDictionary
if let dict = snapshot.value as? NSDictionary
for item in dict
let json = JSON(item.value)
let businessUid = json["uid"].stringValue
for uid in self.data
if uid == businessUid
Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")
if key == uid
print(key)
print("printing the matching keys here")



)
print(uid)
print("Printing the uids here")

Database.database().reference().child("Businesses").child(self.businessessuids).observe(.value, with: snapshot in
print(snapshot)
print(self.businessessuids)

)






)


UPDATE: Found matching values but cannot save



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.jsonKey
print(key)
//print(uid)
print("checking uid's")
//let name = user.childSnapshot(forPath: "name").value as! String
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("their_name")






)









share|improve this question
















I am trying to figure out how I can match the Strings which are Firebase UID's in my "data" array with the keys that I am extracting from the firebase call. I need to match the Strings in the "data" array with "key" and then I will be able to manipulate the data how I want.



 var data = [String]()

Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")


)


enter image description here



enter image description here



My try, answer not in this code



 Database.database().reference().child("Businesses").observeSingleEvent(of: .value, with: snapshot in
self.businessUID = snapshot.value as? NSDictionary
if let dict = snapshot.value as? NSDictionary
for item in dict
let json = JSON(item.value)
let businessUid = json["uid"].stringValue
for uid in self.data
if uid == businessUid
Database.database().reference().child("Businesses").observe(.value, with: snapshot in
guard let allUsers = snapshot.children.allObjects as? [DataSnapshot] else return
print(allUsers)
print("Printing all users right here")
for user in allUsers
let key = user.key
print(key)
print("Printing the keys right here come and check this out in the print")
if key == uid
print(key)
print("printing the matching keys here")



)
print(uid)
print("Printing the uids here")

Database.database().reference().child("Businesses").child(self.businessessuids).observe(.value, with: snapshot in
print(snapshot)
print(self.businessessuids)

)






)


UPDATE: Found matching values but cannot save



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.jsonKey
print(key)
//print(uid)
print("checking uid's")
//let name = user.childSnapshot(forPath: "name").value as! String
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("their_name")






)






ios swift firebase firebase-realtime-database






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 4:43







Lukas Bimba

















asked Mar 22 at 5:01









Lukas BimbaLukas Bimba

221118




221118












  • Can you attach your Firebase table of allUsers ?

    – Amir Khan
    Mar 22 at 5:08











  • What is it that you want to see? All you would see if the parent "Businesses" then the UIDs then the data that uid's hold

    – Lukas Bimba
    Mar 22 at 5:11











  • Yes what allUsers contains ? more precisely, the structure of allUsers.

    – Amir Khan
    Mar 22 at 5:12











  • Just added it. Thats just a sample because it keeps going for a while lol

    – Lukas Bimba
    Mar 22 at 5:18











  • Got that. Thanks. Let me dig into this.

    – Amir Khan
    Mar 22 at 5:31

















  • Can you attach your Firebase table of allUsers ?

    – Amir Khan
    Mar 22 at 5:08











  • What is it that you want to see? All you would see if the parent "Businesses" then the UIDs then the data that uid's hold

    – Lukas Bimba
    Mar 22 at 5:11











  • Yes what allUsers contains ? more precisely, the structure of allUsers.

    – Amir Khan
    Mar 22 at 5:12











  • Just added it. Thats just a sample because it keeps going for a while lol

    – Lukas Bimba
    Mar 22 at 5:18











  • Got that. Thanks. Let me dig into this.

    – Amir Khan
    Mar 22 at 5:31
















Can you attach your Firebase table of allUsers ?

– Amir Khan
Mar 22 at 5:08





Can you attach your Firebase table of allUsers ?

– Amir Khan
Mar 22 at 5:08













What is it that you want to see? All you would see if the parent "Businesses" then the UIDs then the data that uid's hold

– Lukas Bimba
Mar 22 at 5:11





What is it that you want to see? All you would see if the parent "Businesses" then the UIDs then the data that uid's hold

– Lukas Bimba
Mar 22 at 5:11













Yes what allUsers contains ? more precisely, the structure of allUsers.

– Amir Khan
Mar 22 at 5:12





Yes what allUsers contains ? more precisely, the structure of allUsers.

– Amir Khan
Mar 22 at 5:12













Just added it. Thats just a sample because it keeps going for a while lol

– Lukas Bimba
Mar 22 at 5:18





Just added it. Thats just a sample because it keeps going for a while lol

– Lukas Bimba
Mar 22 at 5:18













Got that. Thanks. Let me dig into this.

– Amir Khan
Mar 22 at 5:31





Got that. Thanks. Let me dig into this.

– Amir Khan
Mar 22 at 5:31












2 Answers
2






active

oldest

votes


















3














I've done some changes in snapshot. Though I haven't verify as I don't have any Firebase database setup at my end as yours.



Database.database().reference().child("Businesses").observe(.value, with: snapshot in

if snapshot.exists()

for snapChild in snapshot.children

if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]

debugPrint("User uid: ", user!["uid"] as! String)




)


Replace your call with above code snippet and let me know if you are still having any issue.



Note: You can also improvisation you all user structure into model for better use.






share|improve this answer























  • Hey, just seeing this. I am going to check it out and let you know.

    – Lukas Bimba
    Mar 22 at 18:55











  • I understand why you said that "var data = [String]()" is empty, yet it isn't. Imagine it has 2 uid strings within it and whats needed is a compare to "user" for matching UID's. Im posting code I was trying before. This code I am posted is not with your answer just my attempts.

    – Lukas Bimba
    Mar 23 at 1:31











  • With my added code, you'll see I compare the JSON string UID by doing "for uid in self.data"

    – Lukas Bimba
    Mar 23 at 1:35











  • Hey can you check out my update on your code? I matched the values but cannot save because "uid.jsonKey" is not a proper String.

    – Lukas Bimba
    Mar 23 at 4:44











  • I am currently trying some other methods of attack

    – Lukas Bimba
    Mar 23 at 4:46


















0














This works. Great Success!



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.description
print(key)
print("checking uid's")
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("tested")
saveUID.setValue("String")






)





share|improve this answer























  • That's awesome!

    – Amir Khan
    Mar 23 at 5:03











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293180%2fswift-firebase-match-uid-keys-with-a-array-of-uid-strings%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














I've done some changes in snapshot. Though I haven't verify as I don't have any Firebase database setup at my end as yours.



Database.database().reference().child("Businesses").observe(.value, with: snapshot in

if snapshot.exists()

for snapChild in snapshot.children

if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]

debugPrint("User uid: ", user!["uid"] as! String)




)


Replace your call with above code snippet and let me know if you are still having any issue.



Note: You can also improvisation you all user structure into model for better use.






share|improve this answer























  • Hey, just seeing this. I am going to check it out and let you know.

    – Lukas Bimba
    Mar 22 at 18:55











  • I understand why you said that "var data = [String]()" is empty, yet it isn't. Imagine it has 2 uid strings within it and whats needed is a compare to "user" for matching UID's. Im posting code I was trying before. This code I am posted is not with your answer just my attempts.

    – Lukas Bimba
    Mar 23 at 1:31











  • With my added code, you'll see I compare the JSON string UID by doing "for uid in self.data"

    – Lukas Bimba
    Mar 23 at 1:35











  • Hey can you check out my update on your code? I matched the values but cannot save because "uid.jsonKey" is not a proper String.

    – Lukas Bimba
    Mar 23 at 4:44











  • I am currently trying some other methods of attack

    – Lukas Bimba
    Mar 23 at 4:46















3














I've done some changes in snapshot. Though I haven't verify as I don't have any Firebase database setup at my end as yours.



Database.database().reference().child("Businesses").observe(.value, with: snapshot in

if snapshot.exists()

for snapChild in snapshot.children

if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]

debugPrint("User uid: ", user!["uid"] as! String)




)


Replace your call with above code snippet and let me know if you are still having any issue.



Note: You can also improvisation you all user structure into model for better use.






share|improve this answer























  • Hey, just seeing this. I am going to check it out and let you know.

    – Lukas Bimba
    Mar 22 at 18:55











  • I understand why you said that "var data = [String]()" is empty, yet it isn't. Imagine it has 2 uid strings within it and whats needed is a compare to "user" for matching UID's. Im posting code I was trying before. This code I am posted is not with your answer just my attempts.

    – Lukas Bimba
    Mar 23 at 1:31











  • With my added code, you'll see I compare the JSON string UID by doing "for uid in self.data"

    – Lukas Bimba
    Mar 23 at 1:35











  • Hey can you check out my update on your code? I matched the values but cannot save because "uid.jsonKey" is not a proper String.

    – Lukas Bimba
    Mar 23 at 4:44











  • I am currently trying some other methods of attack

    – Lukas Bimba
    Mar 23 at 4:46













3












3








3







I've done some changes in snapshot. Though I haven't verify as I don't have any Firebase database setup at my end as yours.



Database.database().reference().child("Businesses").observe(.value, with: snapshot in

if snapshot.exists()

for snapChild in snapshot.children

if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]

debugPrint("User uid: ", user!["uid"] as! String)




)


Replace your call with above code snippet and let me know if you are still having any issue.



Note: You can also improvisation you all user structure into model for better use.






share|improve this answer













I've done some changes in snapshot. Though I haven't verify as I don't have any Firebase database setup at my end as yours.



Database.database().reference().child("Businesses").observe(.value, with: snapshot in

if snapshot.exists()

for snapChild in snapshot.children

if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]

debugPrint("User uid: ", user!["uid"] as! String)




)


Replace your call with above code snippet and let me know if you are still having any issue.



Note: You can also improvisation you all user structure into model for better use.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 22 at 5:43









Amir KhanAmir Khan

1,8391726




1,8391726












  • Hey, just seeing this. I am going to check it out and let you know.

    – Lukas Bimba
    Mar 22 at 18:55











  • I understand why you said that "var data = [String]()" is empty, yet it isn't. Imagine it has 2 uid strings within it and whats needed is a compare to "user" for matching UID's. Im posting code I was trying before. This code I am posted is not with your answer just my attempts.

    – Lukas Bimba
    Mar 23 at 1:31











  • With my added code, you'll see I compare the JSON string UID by doing "for uid in self.data"

    – Lukas Bimba
    Mar 23 at 1:35











  • Hey can you check out my update on your code? I matched the values but cannot save because "uid.jsonKey" is not a proper String.

    – Lukas Bimba
    Mar 23 at 4:44











  • I am currently trying some other methods of attack

    – Lukas Bimba
    Mar 23 at 4:46

















  • Hey, just seeing this. I am going to check it out and let you know.

    – Lukas Bimba
    Mar 22 at 18:55











  • I understand why you said that "var data = [String]()" is empty, yet it isn't. Imagine it has 2 uid strings within it and whats needed is a compare to "user" for matching UID's. Im posting code I was trying before. This code I am posted is not with your answer just my attempts.

    – Lukas Bimba
    Mar 23 at 1:31











  • With my added code, you'll see I compare the JSON string UID by doing "for uid in self.data"

    – Lukas Bimba
    Mar 23 at 1:35











  • Hey can you check out my update on your code? I matched the values but cannot save because "uid.jsonKey" is not a proper String.

    – Lukas Bimba
    Mar 23 at 4:44











  • I am currently trying some other methods of attack

    – Lukas Bimba
    Mar 23 at 4:46
















Hey, just seeing this. I am going to check it out and let you know.

– Lukas Bimba
Mar 22 at 18:55





Hey, just seeing this. I am going to check it out and let you know.

– Lukas Bimba
Mar 22 at 18:55













I understand why you said that "var data = [String]()" is empty, yet it isn't. Imagine it has 2 uid strings within it and whats needed is a compare to "user" for matching UID's. Im posting code I was trying before. This code I am posted is not with your answer just my attempts.

– Lukas Bimba
Mar 23 at 1:31





I understand why you said that "var data = [String]()" is empty, yet it isn't. Imagine it has 2 uid strings within it and whats needed is a compare to "user" for matching UID's. Im posting code I was trying before. This code I am posted is not with your answer just my attempts.

– Lukas Bimba
Mar 23 at 1:31













With my added code, you'll see I compare the JSON string UID by doing "for uid in self.data"

– Lukas Bimba
Mar 23 at 1:35





With my added code, you'll see I compare the JSON string UID by doing "for uid in self.data"

– Lukas Bimba
Mar 23 at 1:35













Hey can you check out my update on your code? I matched the values but cannot save because "uid.jsonKey" is not a proper String.

– Lukas Bimba
Mar 23 at 4:44





Hey can you check out my update on your code? I matched the values but cannot save because "uid.jsonKey" is not a proper String.

– Lukas Bimba
Mar 23 at 4:44













I am currently trying some other methods of attack

– Lukas Bimba
Mar 23 at 4:46





I am currently trying some other methods of attack

– Lukas Bimba
Mar 23 at 4:46













0














This works. Great Success!



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.description
print(key)
print("checking uid's")
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("tested")
saveUID.setValue("String")






)





share|improve this answer























  • That's awesome!

    – Amir Khan
    Mar 23 at 5:03















0














This works. Great Success!



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.description
print(key)
print("checking uid's")
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("tested")
saveUID.setValue("String")






)





share|improve this answer























  • That's awesome!

    – Amir Khan
    Mar 23 at 5:03













0












0








0







This works. Great Success!



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.description
print(key)
print("checking uid's")
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("tested")
saveUID.setValue("String")






)





share|improve this answer













This works. Great Success!



Database.database().reference().child("Businesses").observe(.value, with: snapshot in
if snapshot.exists()
for snapChild in snapshot.children
if let user: Dictionary? = (snapChild as! DataSnapshot).value as? [String : AnyObject]
let businessUID = user!["uid"] as! String
for uid in self.data
if uid == businessUID
let key = uid.description
print(key)
print("checking uid's")
let Ref = Database.database().reference().child("testing")
let saveUID = Ref.child(key).child("tested")
saveUID.setValue("String")






)






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 23 at 4:49









Lukas BimbaLukas Bimba

221118




221118












  • That's awesome!

    – Amir Khan
    Mar 23 at 5:03

















  • That's awesome!

    – Amir Khan
    Mar 23 at 5:03
















That's awesome!

– Amir Khan
Mar 23 at 5:03





That's awesome!

– Amir Khan
Mar 23 at 5:03

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293180%2fswift-firebase-match-uid-keys-with-a-array-of-uid-strings%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript