Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 11 UIWebView drop down menus completely broken on iPad - UIPopoverController

When using HTML select element, UIWebView presents a native UIPopoverController as dropdown list on iPad (iPhone uses UIPickerView which works fine).

On iOS11 this appears to be completely broken:

  • Clicking outside dropdown to dismiss without selecting an option results in popover being closed and immediately re-presented, occasionally empty
  • When more than one drop down on the page, drop down for new list contains elements from previous list
  • When selecting second drop down, first one re-opens
  • Occassionally drop down appears in top left corner (presumably lost it's source view)
  • Above steps very occasionally result in the following crash:

2017-09-23 09:43:13.190728+0100 Web[1779:86622] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource is not set' * First throw call stack: ( 0 CoreFoundation 0x000000010d4a01cb exceptionPreprocess + 171 1 libobjc.A.dylib
0x000000010c8bbf41 objc_exception_throw + 48 2 CoreFoundation
0x000000010d4a5362 +[NSException raise:format:arguments:] + 98 3
Foundation 0x000000010c360089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4
UIKit 0x000000010da742f5 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 1756 5 UIKit 0x000000010da7451a -[UITableView _createPreparedCellForRowAtIndexPath:willDisplay:] + 81 6 UIKit 0x000000010da82137 -[UITableView _heightForRowAtIndexPath:] + 208 7
UIKit 0x000000010dd2b939 -[UISectionRowData heightForRow:inSection:canGuess:] + 259 8 UIKit 0x000000010dd31c1a -[UITableViewRowData heightForRow:inSection:canGuess:adjustForReorderedRow:] + 277 9
UIKit 0x000000010dd36230 -[UITableViewRowData ensureHeightsFaultedInForScrollToIndexPath:withScrollPosition:boundsHeight:] + 964 10 UIKit 0x000000010da51110 -[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:usingPresentationValues:] + 2783 11 UIKit 0x000000010da51b8f -[UITableView _scrollToRowAtIndexPath:atScrollPosition:animated:usingPresentationValues:] + 146 12 UIKit 0x000000010da51a11 -[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:] + 123 13 UIKit 0x000000010de72d11 -[UIWebSelectTableViewController viewWillAppear:] + 247 14 UIKit 0x000000010dabe9b0 -[UIViewController _setViewAppearState:isAnimating:] + 444 15 UIKit 0x000000010dabf245 -[UIViewController __viewWillAppear:] + 147 16 UIKit 0x000000010da8b881 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 1088 17 UIKit
0x000000010d926c61 _runAfterCACommitDeferredBlocks + 318 18 UIKit
0x000000010d91530d _cleanUpAfterCAFlushAndRunDeferredBlocks + 280 19 UIKit 0x000000010d945600 _afterCACommitHandler + 137 20 CoreFoundation 0x000000010d442db7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION
+ 23 21 CoreFoundation 0x000000010d442d0e __CFRunLoopDoObservers + 430 22 CoreFoundation 0x000000010d427324 __CFRunLoopRun + 1572 23 CoreFoundation
0x000000010d426a89 CFRunLoopRunSpecific + 409 24 GraphicsServices
0x00000001124c89c6 GSEventRunModal + 62 25 UIKit
0x000000010d91ad30 UIApplicationMain + 159 26 Web
0x000000010bfb014f main + 111 27 libdyld.dylib
0x0000000110df1d81 start + 1 28 ???
0x0000000000000001 0x0 + 1`

I created a sample application with one line of code which demonstrates the issue:

https://github.com/AshRobinson/BrokenUIWebView

http://gph.is/2xmHFWs

Does anyone have a workaround for such issue? Migrating to WKWebview is not an option for us at this stage.

Is there any way to force iPad to use UIPickerView for dropdowns as per iPhone temporarily?

I have investigated suggestions in other stack overflow posts with no luck, for example:

ios 11 Beta 5 select drop-down list issue

like image 628
Ash Avatar asked Nov 08 '22 16:11

Ash


1 Answers

We ran into the same bug. Apple's documentation says that any app iOS 8+ should be using WKWebView. Once we switched to WKWebView, we are no longer seeing this issue.

like image 106
eg.rudolph Avatar answered Nov 15 '22 12:11

eg.rudolph