Firebase 데이터베이스의 여러 위치에서 동시에 데이터를 삭제하려고합니다.UpdateChildValues를 사용하여 Firebase에서 삭제
Firebase docs 상태 :
"The simplest way to delete data is to call removeValue on a reference to the location of that data. You can also delete by specifying nil as the value for another write operation such as setValue or updateChildValues. You can use this technique with updateChildValues to delete multiple children in a single API call."
내 코드는 네 가지 경로 문자열
let childUpdates = [path1 : nil,
path2 : nil,
path3 : nil,
path4 : nil]
ref.updateChildValues(childUpdates)
,하지만 난 오류 얻을 :
"Type of expression is ambiguous without more context."
내가 이런 가정 줄을 nil 값으로 인해 nil을 다른 것으로 대체하면 (Int와 같이) 오류가 사라집니다.
updateChildValues를 사용하여 Firebase에서 데이터를 삭제하는 올바른 방법은 무엇입니까? Firebase의 removeValue() 함수와 비슷한 방식으로 작동하기를 원합니다. 우리가 이것을하는 이유는 한 번의 호출로 여러 곳에서 제거 할 수 있기 때문입니다.
내 하루를 절약하십시오 –
정말 고마워요! 이것은 확실히 Firebase 문서에 있어야하므로 매우 실망 스럽습니다! – Crashalot