DOMException 105 only during user interface testing

I get an unhandled DOMException 105 periodically. This only happens when my user interface tests are run.

If I comment on the use of the loadHTMLString:baseURL UIWebView call, the exception will no longer occur.

This makes my tests very unreliable. Any suggestions on how to get around this?

Stack trace:

 2017-01-05 16:57:01.431 Allhomes[64245:4871703] *** Terminating app due to uncaught exception 'DOMException', reason: '*** DOMException 105' *** First throw call stack: ( 0 CoreFoundation 0x0000000110e4dd4b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00000001104b721e objc_exception_throw + 48 2 CoreFoundation 0x0000000110e4dc99 -[NSException raise] + 9 3 WebCore 0x000000011785a542 _ZN7WebCore17raiseDOMExceptionEi + 370 4 WebCore 0x000000011785a55e _ZN7WebCore23raiseTypeErrorExceptionEv + 14 5 WebCore 0x00000001177e311e -[DOMRange setStart:offset:] + 158 6 UIKit 0x000000010d92edab -[UIWebDocumentView text] + 292 7 UIKit 0x000000010d6afcde _UIViewDescriptionAppendTextIfApplicable + 96 8 UIKit 0x000000010d6afe91 -[UIView(UIDebugging) description] + 147 9 CoreFoundation 0x0000000110e2374a -[NSArray descriptionWithLocale:indent:] + 362 10 Foundation 0x000000010ff80a9e _NSDescriptionWithLocaleFunc + 66 11 CoreFoundation 0x0000000110d8b7d7 __CFStringAppendFormatCore + 10983 12 CoreFoundation 0x0000000110d88cc7 _CFStringCreateWithFormatAndArgumentsAux2 + 263 13 AccessibilityUtilities 0x000000012544e38f _AXStringForArgs + 333 14 UIAccessibility 0x0000000125f29fe2 -[UIView(UIAccessibilityElementTraversal) _accessibilitySubviewsForGettingElementsWithOptions:] + 199 15 UIAccessibility 0x0000000125f2ae3b -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 743 16 UIAccessibility 0x0000000125f2aec6 -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 882 17 UIAccessibility 0x0000000125f2aec6 -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 882 18 UIAccessibility 0x0000000125f2aec6 -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 882 19 UIAccessibility 0x0000000125f2b3e4 +[UIView(UIAccessibilityElementTraversal) _accessibilityElementsAndContainersDescendingFromViews:options:sorted:] + 472 20 UIAccessibility 0x0000000125f2b599 -[UIView(UIAccessibilityElementTraversal) _accessibilityViewChildrenWithOptions:] + 186 21 UIKit 0x0000000125db20ab -[UITableViewCellAccessibility _accessibilityRetrieveTableViewCellText] + 1551 22 UIKit 0x0000000125db2ed1 -[UITableViewCellAccessibility _accessibilityChildren] + 1534 23 UIKit 0x0000000125dac175 -[UITableViewCellAccessibility _accessibilityUserTestingChildren] + 82 24 UIKit 0x0000000125dac0f7 -[UITableViewCellAccessibility _accessibilityUserTestingChildrenCount] + 24 25 UIKit 0x0000000125dc0d24 -[UITableViewCellAccessibilityElement _accessibilityUserTestingChildrenCount] + 48 26 UIAccessibility 0x0000000125f3890b -[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 5720 27 UIAccessibility 0x0000000125f53636 -[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 1814 28 UIAccessibility 0x0000000125f54f96 -[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 557 29 UIAccessibility 0x0000000125f36c0a -[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 7903 30 UIAccessibility 0x0000000125f20856 _copyParameterizedAttributeValueCallback + 211 31 AXRuntime 0x000000012558f532 _AXXMIGCopyParameterizedAttributeValue + 216 32 AXRuntime 0x0000000125589f1c _XCopyParameterizedAttributeValue + 440 33 AXRuntime 0x0000000125598de5 mshMIGPerform + 266 34 CoreFoundation 0x0000000110ddf3d9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41 35 CoreFoundation 0x0000000110ddf351 __CFRunLoopDoSource1 + 465 36 CoreFoundation 0x0000000110dd7435 __CFRunLoopRun + 2389 37 CoreFoundation 0x0000000110dd6884 CFRunLoopRunSpecific + 420 38 GraphicsServices 0x00000001151ada6f GSEventRunModal + 161 39 UIKit 0x000000010d5e8c68 UIApplicationMain + 159 40 Appname 0x000000010c127a33 main + 99 41 libdyld.dylib 0x000000011261068d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException 
+5
source share
2 answers

Same issue here using UIWebView with scoring. I added the view controller as a delegate of the web view and added the following code (to indicate that the tree has changed) and I no longer have an error:

 - (void)webViewDidStartLoad:(UIWebView *)webView { UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); } 

Does it work for you too?

UPDATE 1

The error appears less often, but sometimes appears ...

UPDATE 2

Creating a web view that is not visible due to scoring when loading its contents seems to work so far ...:

 - (void)webViewDidStartLoad:(UIWebView *)webView { self.webView.accessibilityElementsHidden = YES; } - (void)webViewDidFinishLoad:(UIWebView *)webView { self.webView.accessibilityElementsHidden = NO; } 
+5
source

Swift 3 version: add these lines to the UIWebViewDelegate:

 // Prevent Accessibility Crash func webViewDidStartLoad(_ webView: UIWebView) { self.webView.accessibilityElementsHidden = true } func webViewDidFinishLoad(_ webView: UIWebView) { self.webView.accessibilityElementsHidden = false } 

Note. Consider using WKWebview instead of UIWebView.

+4
source

Source: https://habr.com/ru/post/1262331/


All Articles