Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios “我该如何解决?”;反应性<_&燃气轮机';是含糊不清的;tableView上下文中出现错误_Ios_Swift_Uitableview_Rx Swift_Rx Cocoa - Fatal编程技术网

Ios “我该如何解决?”;反应性<_&燃气轮机';是含糊不清的;tableView上下文中出现错误

Ios “我该如何解决?”;反应性<_&燃气轮机';是含糊不清的;tableView上下文中出现错误,ios,swift,uitableview,rx-swift,rx-cocoa,Ios,Swift,Uitableview,Rx Swift,Rx Cocoa,我有一个方法,它返回一个单值: func getEventStatus() throws -> Single<EventModel?> { return try mainService.getEventStatus() } 作为方法抛出的我添加了do{try catch{},但这似乎没有什么区别 我在这里遗漏了什么?问题是您的方法的签名 getEventStatus()方法只发出一个EventModel,甚至是一个可选的 items(cellIdentifier:ce

我有一个
方法
,它返回一个
单值

func getEventStatus() throws -> Single<EventModel?> {
    return try mainService.getEventStatus()
}
作为
方法
抛出的
我添加了
do{try catch{}
,但这似乎没有什么区别


我在这里遗漏了什么?

问题是您的方法的签名

getEventStatus()
方法只发出一个
EventModel
,甚至是一个
可选的


items(cellIdentifier:cellType:)
方法需要一个数组。

谢谢@Daniel,但我如何将其转换为数组?我试了
试了?viewModel.getEventStatus().asObservable().toArray().bind…
但是它说“'PrimitiveSequence'没有成员'bind'”,在EventModel周围放上括号,去掉问号。
viewModel.getEventStatus().asObservable().bind(to: tableView.rx.items(cellIdentifier: EventLogTableViewCell.identifier, cellType: EventLogTableViewCell.self)) { row, data, cell in
    cell.viewModel = data
}.disposed(by:disposeBag)