wordpress-mobile / MediaPicker-iOS

WPMediaPicker is an iOS controller that allows capture and picking of media assets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

2017-08-09 15_25_40

Steps to reproduce the behavior

  1. Launch the input picker by tapping the quick select assets field.
  2. Slide a secondary app over the top of the WPMediaPicker demo app — the picker will disappear (expected).
  3. Anchor the slide over pane of the secondary app so the screen becomes a Split View. Input picker will reappear (expected).
  4. 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:

3

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