我得到的参数标签'_ :, withBlock,withCancel :)'不匹配任何可用的重载。斯威夫特3
问题描述:
使用斯威夫特3,我得到生成错误:我得到的参数标签'_ :, withBlock,withCancel :)'不匹配任何可用的重载。斯威夫特3
Argument labels '_:, withBlock, withCancel:)' do not match any available overloads
代码:
let ref = FIRDatabase.database().reference().child("users").child(chatPartnerId)
ref.observeSingleEventOfType.(.value, withBlock: { (snapshot) in
print(snapshot)
}, withCancel: nil)
答
雨燕3.0
let ref = FIRDatabase.database().reference().child("users").child(chatPartnerId)
ref.observeSingleEvent(of: .value, with: { (snapshot) in
print("Snapshot:", snapshot.value as! String)
}, withCancel: nil)
你需要看的方法签名为该方法确定适当的参数。 intellisense应该给你一个想法 – bhmahler