ios - Using UpdateChildValues to delete from Firebase -


i trying delete data several locations in firebase database simultaneously.

the firebase docs state:

"the simplest way delete data call removevalue on reference location of data. can delete specifying nil value write operation such setvalue or updatechildvalues. can use technique updatechildvalues delete multiple children in single api call."

my code is

let childupdates = [path1 : nil,                     path2 : nil,                     path3 : nil,                     path4 : nil]      ref.updatechildvalues(childupdates) 

all 4 paths strings, error:

"type of expression ambiguous without more context."

i'd assume occurs because of nil values, since if replace nil else (such int) error disappears.

what correct way use updatechildvalues delete data firebase? want work in similar way removevalue() function in firebase. reason prefer because can remove multiple places in 1 call.

so issue here that

ref.updatechildvalues(childupdates) 

requires [string: anyobject!] parameter updatechildvalues, , anyobject! cannot nil (i.e. can't use anyobject? optional nil)

however, can this

let childupdates = [path1 : nsnull(),                     path2 : nsnull(),                     path3 : nsnull(),                     path4 : nsnull()] 

because anyobject! nsnull() object (not nil), , firebase knows nsnull nil value.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -