我刚刚更新到Swift 3中的Xcode,我不知道如何处理这个错误。有人能帮忙吗?
错误: InvalidFirebaseData',原因:'(setValue:)无法在thumbnailUrlFromStorage存储_SwiftValue类型的对象。只能存储NSNumber、NSString、NSDictionary和NSArray类型的对象。
我的代码是:
// Create a url for data (tumbnail image)
self.fileUrl = metaData?.downloadURLs![0].absoluteString
if (FIRAuth.auth()?.currentUser) != nil {
let idRoom = self.BASE_REF.child("rooms").childByAutoId()
idRoom.setValue(["caption": caption, "thumbnailUrlFromStorage": self.storageRef.child(metaData!.path!).description, "fileUrl": self.fileUrl])发布于 2016-09-24 12:36:27
if (FIRAuth.auth()?.currentUser) != nil {
let idRoom = self.BASE_REF.child("rooms").childByAutoId()
let thumbnailUrlFromStorage: String = self.storageRef.child(metaData!.path!).description
let data: Dictionary<String, Any> = [
"caption": caption,
"thumbnailUrlFromStorage": thumbnailUrlFromStorage,
"fileUrl": self.fileUrl
]
idRoom.setValue(data)
}不确定这是否有效,因为我没有机会运行它,但在我看来,您将self.storageRef.child(metaData!.path!).description作为零传递。
https://stackoverflow.com/questions/39675045
复制相似问题