I'm on Mac Catalyst.
I have a UISearchController and I keep getting this crash after I clear the search bar, adjust the search scope segmented control if one of the UITableViewCells is focused (via arrow key press) before
Focus item does not provide a parentFocusEnvironment.
I can workaround the problem by overriding -parentFocusEnvironment, holding the parent UITableView in a property and returning it:
-(id<UIFocusEnvironment>)parentFocusEnvironment
{
id<UIFocusEnvironment>theFocus = [super parentFocusEnvironment];
if (theFocus == nil)
{
return self.cachedParentFocus;
}
else
{
self.cachedParentFocus = theFocus
}
return theFocus;
}
The problem with this is it is likely to create a retain cycle (I did try a weak reference but that can cause the following crasher on deallocation (the focus environment continues to call this method on the table view cell even when its outside of a UIWindow):
“Cannot form weak reference to instance (0x13799a000) of class UITableView. It is possible that this object was over-released, or is in the process of deallocation.”
Anyone run into this and know of a potential workaround?