3

在快速调试时,这可能是Xcode 9 崩溃的重复,但是因为我有一个新帐户,所以我无法在那里发表评论。

我正在使用 XCode 9.1 (9B55) 和 RxSwift / RxCocoa 4.0.0

我正在尝试将我的 TableView 代码迁移到 RxSwift,但每次我的 ViewController 在模拟器或我的设备上加载时,XCode 都会与应用程序一起崩溃。

ViewController 设置为我的 UIWindow 的 rootViewController,因此它是应用程序中加载的第一件事。

这是我的简化视图控制器:

import UIKit
import RxSwift
import RxCocoa

struct DummyProfile {
    let name: String
    let vid: String
    let userName: String
}

class ProfilesCollectionViewController: UITableViewController {

    private let disposeBag = DisposeBag()

    let profileList = [
            DummyProfile(name: "Test1", vid: "VIDASLKDHASKLDH", userName: "User"),
            DummyProfile(name: "Test1adasidhaskljdhaskljdhaksldhjaskdha", vid: "VIDASLKDHASKLDH", userName: "User"),
            DummyProfile(name: "86435543536543455324", vid: "VIDASLKDHASKLDH", userName: "fluigadshkljdhkldjsfgh ask jgfhaklseth kjahgkds")
        ]

    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.register(ProfileCell.self, forCellReuseIdentifier: "ProfileCell")
        tableView?.alwaysBounceVertical = true
        tableView?.backgroundColor = .lightGray

        Observable.just(profileList).bind(to: tableView.rx.items(cellIdentifier: "ProfileCell", cellType: ProfileCell.self)) { (_, model, cell) in
                cell.viewModel = model
            }.disposed(by: disposeBag)
    }
}

我不认为我的 ProfileCells 的代码很重要,因为它基本上只是几个 UIView 和 AutoLayout 的东西,当我不使用 RxCocoa / RxSwift 时,一切都得到确认。

这是 XCode 崩溃报告之一。我没有其他事情要做:

https://pastebin.com/MPpuGZym

我做错了什么还是我的工具链中的某个错误?

4

2 回答 2

4

在浏览了 RxSwift github 问题后,我遇到了这个问题: https ://github.com/ReactiveX/RxSwift/issues/1463

虽然不完全相同,但我尝试了建议的解决方案 - 将 Pod 的优化级别从无提升到快速。

那成功了。

帮助的截图。

于 2017-11-18T10:38:46.143 回答
3

我有类似的情况,但是

tableView.datasource = nil

在 UITableViewController 的 viewDidLoad() 中做到了

于 2018-03-17T12:54:24.203 回答