Input picker becomes empty when multitasking
bummytime opened this issue · comments
When the input picker is displayed on-screen and a secondary app is slid over the input picker disappears as expected. However, if the secondary app enters Split View the input picker will reappear with an empty collection view.
Steps to reproduce the behavior
- Launch the input picker by tapping the quick select assets field.
- Slide a secondary app over the top of the WPMediaPicker demo app — the picker will disappear (expected).
- Anchor the slide over pane of the secondary app so the screen becomes a Split View. Input picker will reappear (expected).
- Notice the picker is empty.
Tested on iPad Pro 10.5", iOS 10.3.3, WPMediaPicker Demo
Upon further investigation, it looks like our input view is getting removed from the view hierarchy when the keyboard reappears:
In WPInputMediaPickerViewController
, viewWillDisappear
and viewDidDisappear
are being called once on the initial resize before the inputView
is removed from the view stack (and thus, viewWill*
and viewDid*
methods are never called again). WPInputMediaPickerViewController
is also residing in memory and not being dealloc
'ed as far as I can tell. Also, as expected, the UITextField
in the demo app is never resigning first responder status.
Unless I am missing something, this is feeling like an OS-level bug.
So I did some more tests on this, and used the traitCollectionDidChange
events to detect change of sizes and then try to reactivate the picker.
But then got stuck because, event I create a new picker that assign it, the toolbar stop working and picker got blank when I try to interact with it.
One thing that I also tested was to use a simple UIView, to use as inputView, when using that simple view it looks all works correctly, so I'm thinking there is some kind of issue of using a ViewController view as the inputView.
Radar filed with Apple re: using VC-owned views as an input view: http://www.openradar.me/radar?id=4972612522344448