This happens when using Mixpanel Tweaks, but can happen elsewhere.
The TMBarButtonInteractionController class isn't Hashable. However, it's added as a target to a TMBarButtonItem (i think). If the TMBarButtonItem's .allTargets property is fetched, the app will crash since UIKit is trying to cast TMBarButtonInteractionController to AnyHashable.
This is arguably a UIKit bug since the API for UIControl.addTarget only reuires that the target is Any?. However when calling .allTargets, UIKit crashes trying to cast the target to AnyHashable.
New Issue Checklist
Issue Description
This happens when using Mixpanel Tweaks, but can happen elsewhere.
The
TMBarButtonInteractionController
class isn't Hashable. However, it's added as a target to a TMBarButtonItem (i think). If the TMBarButtonItem's.allTargets
property is fetched, the app will crash since UIKit is trying to castTMBarButtonInteractionController
toAnyHashable
.This is arguably a UIKit bug since the API for
UIControl.addTarget
only reuires that thetarget
isAny?
. However when calling.allTargets
, UIKit crashes trying to cast the target toAnyHashable
.In any case, I've filed an apple radar, and asked on the forums (https://developer.apple.com/forums/thread/653574), but this doesn't seem like something that will get fixed soon.
By making
TMBarButtonInteractionController
Hashable, this bug goes away.I've got a Pull request for this that I'll post in a few minutes.