【发布时间】:2017-09-23 09:18:14
【问题描述】:
当使用 HTML 选择元素时,UIWebView 在 iPad 上呈现一个原生的 UIPopoverController 作为下拉列表(iPhone 使用 UIPickerView 可以正常工作)。
在 iOS11 上,这似乎完全被破坏了:
- 在不选择选项的情况下单击外部下拉菜单以关闭会导致弹出框被关闭并立即重新呈现,有时为空
- 当页面上有多个下拉菜单时,新列表的下拉菜单包含上一个列表中的元素
- 选择第二次下拉时,首先重新打开
- 偶尔会在左上角出现下拉菜单(估计是丢失了它的源视图)
- 上述步骤偶尔会导致以下崩溃:
2017-09-23 09:43:13.190728+0100 Web[1779:86622] * 终止应用 由于未捕获的异常“NSInternalInconsistencyException”,原因: '未设置 UITableView 数据源' * 第一次抛出调用堆栈:( 0 CoreFoundation 0x000000010d4a01cb exceptionPreprocess + 171 1 libobjc.A.dylib
0x000000010c8bbf41 objc_exception_throw + 48 2 核心基础
0x000000010d4a5362 +[NSException raise:format:arguments:] + 98 3
基础 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 核心基础 0x000000010d442db7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 21 核心基础 0x000000010d442d0e __CFRunLoopDoObservers + 430 22 CoreFoundation 0x000000010d427324 __CFRunLoopRun + 1572 23 CoreFoundation
0x000000010d426a89 CFRunLoopRunSpecific + 409 24 图形服务
0x00000001124c89c6 GSEventRunModal + 62 25 UIKit
0x000000010d91ad30 UIApplicationMain + 159 26 Web
0x000000010bfb014f 主要 + 111 27 libdyld.dylib
0x0000000110df1d81 开始 + 1 28 ???
0x0000000000000001 0x0 + 1`
我用一行代码创建了一个示例应用程序来演示该问题:
https://github.com/AshRobinson/BrokenUIWebView
有没有人可以解决此类问题?在这个阶段,迁移到 WKWebview 不是我们的选择。
有什么办法可以强制 iPad 暂时按照 iPhone 使用UIPickerView 进行下拉菜单?
我调查了其他堆栈溢出帖子中的建议,但没有运气,例如:
【问题讨论】:
-
遇到同样的问题。还没有解决方案。
标签: ipad uiwebview dropdown uipopovercontroller ios11