0
votes

I convert my code to swift 3 , and Im getting the following error when trying to read some data:

Cannot convert value of type '(_) -> ()' to expected argument type '((Error) -> Void)?'

Ref.observe(.value, with: { snapshot in
   print(snapshot)
}, withCancel: { error in  //the error appear here
        print(error.description)
})
1
Xcode acts weirdly sometimes when interacting with firebase... Try setting explicitly the types of the snapshot and the error. ref.observe(.value, with: { (snap: FIRDataSnapshot) in }, withCancel: { (error: Error) in })gasho
post it as an answer , I'll accept it , THANKSjerem

1 Answers

1
votes

As I said in the comment you have to set the types. I am really glad I helped you. Thank you for your appreciation. Happy coding.

ref.observe(.value, with: { (snap: FIRDataSnapshot) in }, withCancel: { (error: Error) in })