objcio / app-architecture

Sample Code of the App Architecture Book
https://www.objc.io/books/app-architecture
2.06k stars 306 forks source link

MVVM-C example fails assertion, crashes on launch #23

Open jefflovejapan opened 5 years ago

jefflovejapan commented 5 years ago

The problem seems to be on line 20 of FolderViewController:

viewModel.folderContents.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: disposeBag)

I'm getting the following:

2019-05-23 12:20:09.318611-0300 Recordings[15921:6162304] Warning: Unable to create restoration in progress marker file
Assertion failed: This is a feature to warn you that there is already a delegate (or data source) set somewhere previously. The action you are trying to perform will clear that delegate (data source) and that means that some of your features that depend on that delegate (data source) being set will likely stop working.
If you are ok with this, try to set delegate (data source) to `nil` in front of this operation.
 This is the source object value: <UITableView: 0x7fa7e805c200; frame = (0 0; 375 812); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x60800005bdb0>; layer = <CALayer: 0x60000023a040>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}>
 This is the original delegate (data source) value: <Recordings.FolderViewController: 0x7fa7e7d1a890>
Hint: Maybe delegate was already set in xib or storyboard and now it's being overwritten in code.
: file /Users/jeff/Developer/app-architecture/Recordings-MVVM-C/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift, line 222
2019-05-23 12:20:15.881476-0300 Recordings[15921:6162304] Assertion failed: This is a feature to warn you that there is already a delegate (or data source) set somewhere previously. The action you are trying to perform will clear that delegate (data source) and that means that some of your features that depend on that delegate (data source) being set will likely stop working.

This seems to happen in both Xcode 9.4.1 and 10.2 using RxSwift 4.0.0 and RxDataSources 3.0.2. Setting the tableView's delegate and dataSource to nil after super.viewDidLoad() fixes the issue for me.

evanbrass commented 5 years ago

same for me - I tried installing RxSwift using cocoapods, but so far haven't had any success

leopic commented 4 years ago

@jefflovejapan thanks for the heads up, this was the only way I could get the app to run