Fix swizzle loadView on UITableViewController #4069
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#4070
We've been getting a crash caused by Sentry in an IB file which is a subclass of
UITableViewController
. We've verified that this only happens when bothenableSwizzling
andenableUIViewControllerTracing
, disabling either one fixes the issue.We believe the crash is caused by sentry swizzling the
loadView
method, and the risk of this is acknowledged in a comment next to where this is done. This function has a check to test if theloadView
method was overridden or not by comparing it to the default implementation fromUIViewController
. However, this does not include other subclasses ofUIViewController
from UIKit likeUITableViewController
that could have a different implementation internally than the one in UIViewController.The proposed fix is to also check for
UITableViewController
in this function. If the theory mentioned above is correct, it means that just checking for these two might not be enough and it could be necessary to check for all possible view controllers provided by UIKit.This fix has not been tested