使用 Firebase 的 SetValue 完成块 3.x

SetValue Completion Block with Firebase 3.x

在 Firebase 2.5.1 中,这是有效的:

let post1Ref = sendRequestRef.childByAutoId()
post1Ref.setValue(request, withCompletionBlock: {( error:NSError?, ref:Firebase!) in

})

但是,我不知道如何在 3.x 中实现它(因为完成的 docs 并没有真正说明)

let post1Ref = sendRequestRef.childByAutoId()
post1Ref.setValue(request, withCompletionBlock: {( error:NSError?, ref:Firebase!) in
    if (error != nil) {
       print("ERROR")
    } else {
       print("Success")
    }
})

这会引发错误:

Use of unresolved Firebase

使用 Firebase 处理完成块的正确方法是什么 3.x?

使用

ref.setValue(object) { (error, ref) -> Void in

}

这里的ref是FIRDatabaseReference