bibscy
bibscy

Reputation: 2708

Firebase 5: Ambiguous use of 'observeSingleEvent'

What is wrong with the way in which I am making this call on a Firebase reference?

I keep getting error Ambiguous use of 'observeSingleEvent'

func updateFcmTokenOnChats(userID: String, fcmToken: String) {
    let ref =  DDatabaseRReference.users(uid: userID).reference().child("chatIds")
    ref.observeSingleEvent(of: DataEventType.value) { (snapReceived) in
        print("someCode")
    }  
}//end of updateFcmTokenOnChats

Here is an explanatory image of the error message:

enter image description here

Upvotes: 1

Views: 224

Answers (1)

Kerberos
Kerberos

Reputation: 4166

You can try to solve the compiler confusion using:

ref.observeSingleEvent(of: DataEventType.value, with: { (snapReceived) in
        ...
})

Upvotes: 3

Related Questions