【问题标题】:Xcode is not recognizing FUITableViewDataSourceXcode 无法识别 FUITableViewDataSource
【发布时间】:2017-03-28 05:35:35
【问题描述】:

我想使用 FUITableViewDataSource 作为我的 tableView 数据源,但我不断收到“无法识别的文件类型”错误。

这是我的文件头。

import UIKit
import Firebase
import SwiftyJSON

Podfile 有:

pod 'FirebaseCore', '~> 3.0'
pod 'FirebaseDatabase', '~> 3.0'
pod 'FirebaseUI', '~> 3.0'

还有一些我的代码不起作用:

var dataSource: FUITableViewDataSource!

艾米,我在这里做错了什么?

解决方案:实际上您必须导入 FirebaseDatabaseUI

【问题讨论】:

  • 也许导入 FirebaseUI?
  • 它说FirebaseUI没有这样的模块

标签: swift xcode firebase firebase-realtime-database


【解决方案1】:

下面的代码是代码应该如何实现的。您需要提供更多代码,因为我们需要了解您是如何实现数据源的。另外,代码不起作用是什么意思。它是否显示任何错误消息?

let firebaseRef = FIRDatabase.database().reference()
var dataSource: FUITableViewDataSource!

self.dataSource = self.tableView.bind(to: self.firebaseRef) { tableView, indexPath, snapshot in

// Dequeue cell

let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)

/* populate cell */

return cell
}

【讨论】:

  • 它说未声明的类型'FUITableViewDataSource'
猜你喜欢
  • 2018-05-02
  • 2016-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-19
  • 2018-04-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多