2016-12-13 144 views
0

我我的代碼轉換爲快捷3,並即時得到嘗試讀取一些數據時出現以下錯誤:firebase swift 3轉換:無法將類型'(_) - >()'的值轉換爲期望的參數類型'((錯誤) - >無效)?

無法將類型的值「(_) - >()」到期望的參數類型「((錯誤) - >無效)?'

Ref.observe(.value, with: { snapshot in 
    print(snapshot) 
}, withCancel: { error in //the error appear here 
     print(error.description) 
}) 
+1

Xcode有時會在與firebase進行交互時出現奇怪現象...嘗試顯式設置快照類型和錯誤。 'ref.observe(.value,與:{(snap:FIRDataSnapshot)in },withCancel:{(error:Error)in })' – gasho

+0

將其作爲答案發布,我會接受它,謝謝 – jerem

回答

1

正如我在評論中說的,你必須設置類型。我很高興我幫助你。感謝您的讚賞。快樂的編碼。

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