【发布时间】:2017-07-27 03:59:39
【问题描述】:
我的 firebase 结构设置如下:
每个键都包含我想用来填充 UICollectionView 的数据。但是,我在访问 Firebase 数据时遇到了困难。在Android中,我使用了类似于
的方法dataSnapshot.child("xxx").getValue()
但是,这种类型的可访问性在 iOS 中似乎不可用。以下是我正在尝试的方法:
self.dataSource = self.collectionView?.bind(to: self.ref.child("Polls")) { collectionView, indexPath, snap in
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! PollCell
/* populate cell */
cell.pollQuestion.text = snap.child("question").getvalue
print(indexPath)
return cell
}
我收到一条错误消息,指出“FIRDataSnapshot”类型的值没有子成员
【问题讨论】:
标签: ios swift firebase firebase-realtime-database firebaseui