Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
253 views
in Technique[技术] by (71.8m points)

ios - How can I delete a specific child node in Firebase from UITableViewCell using Swift

I have a UITableView which looks like this image

this image.

When I swipe to delete the record, I can remove it perfectly okay from the array in which it is stored, but I am having difficulties in accessing it in Firebase to delete it there.

My Firebase database structure is as follows for the above screenshot:

 -KWc7RTuOe5PefiMM2tL
    bodyPart: "Arms"
    exerciseName: "Test 1 "
    userId: "8rHmyTxdocTEvk1ERiiavjMUYyD3"
 -KWcEbpw_f6kxcePY5cO
    bodyPart: "Chest"
    exerciseName: "Test 2 "
    userId: "8rHmyTxdocTEvk1ERiiavjMUYyD3"
 -KWcEdUN49QaJIVf0kwO
    bodyPart: "Legs"
    exerciseName: "Test 3 "
    userId: "8rHmyTxdocTEvk1ERiiavjMUYyD3"
 -KWcFrMSaLKQRxghGHyT
    bodyPart: "Arms"
    exerciseName: "Test 4"
    userId: "8rHmyTxdocTEvk1ERiiavjMUYyD3"

How can I access the autoId value which is set when it is created e.g "-KWc7RTuOe5PefiMM2tL" so I can remove that child node?

Or alternatively could I access the exerciseName value depending on the UserId that is logged in?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...