-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RxCocoa/RxSwift crash when accessing TableViewDataSourceNotSet tableView(_:cellForRowAt:) #2507
Comments
In order for this to happen, something needs to be returning a positive, non-zero, value from Apple made some internal changes to how table views work (i.e., added a bug to table views) recently, which is fixed in the latest version of RxCocoa... Your error doesn't seem to be related to that issue, but it is a good idea for you to update to the latest versions of RxSwift and RxCocoa. Note that your code sample is not self-contained. Also note that this issue is also being discussed here (https://stackoverflow.com/questions/75952981/rxcocoa-rxswift-crash-when-accessing-tableviewdatasourcenotset-tableview-cellf) |
@alexeystrakh |
Can one of you create self-contained code sample? |
I can work on the self-contained code sample but see no value in it, because the code follows the guidelines and works in 99.99% cases. Basically when you run it, you wont see any crashes and most likely won't be able to reproduce. I believe the issue is in either UIKit or RxCocoa as the stack trace points there as should be handled respectively. Meanwhile, I will create a sample project to reflect the code structure and the rx bindings. |
Since this has never come up before in the past 8 years, either you are doing something wrong, or Apple has indeed changed something inside UIKit (this wouldn't be the first time they've done that) or there is a specific issue within Firebase. So questions:
Can you provide analytics that can answer the first question? Can you remove Firebase from the equation to see if that fixes the problem? |
Here we go, the self-contained solution: https://github.com/alexeystrakh/rxswift-tablecrash
iOS 15 and iOS 16 (foreground only)
Without Firebase it will be hard to say, because they are only reported by Firebase, I cannot reproduce them locally. |
@danielt1263 where you able to confirm an issue or find some workaround for this crash? |
I was not. |
Short description of the issue:
I'm using RxCocoa and RxSwift to render a UITableView against an array provided by a BehaviorRelay. The code to bind the data is below. In most cases it works just fine but in some rare cases which I cannot reproduce the app crashes with the following stacktrace, reported by a few Firebase uses:
The crash is hard to reproduce (I wasn't able to) but it's affects multiple users. The
bindData
method is called once atviewDidLoad
, and I callloadData
on every page appearance (willAppear, return back from another page or app activation deactivation) but it's not clear why it crashes and how to reproduce/fix it.The crash is coming from
TableViewDataSourceNotSet
which seems to be set by the RxCocoa/RxSwift framework and crashes when cell for an item is requested. I'm not setting that custom dataSource explicitly anywhere. Any ideas how I can prevent this from happening?Expected outcome:
App renders the table and no crashes are reported by users in Firebase
What actually happens:
App renders the table but a few users report crashes
TableViewDataSourceNotSet
Self contained code example that reproduces the issue:
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
v5.1.1
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
Installation method:
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)
The text was updated successfully, but these errors were encountered: