Error fetching snapshot when using XCTest UI tests due to NSMuta

Originator:krze
Number:rdar://25623858 Date Originated:04/08/2016
Status:Resolved Resolved:06/17/2016
Product:Xcode Product Version:7.3 (7D175)
Classification:UI Tests Reproducible:Always
 
Summary:
When an NSMutableAttributedString with custom attribute is within the hierarchy, and an XCTest UI test queries the hierarchy, the exception is thrown. Attached is an example project that reproduces the issue.

Steps to Reproduce:
1. Download and unzip the attached Xcode project
2. Open the project
3. Run the test in XCUITestCrashTestUITests.swift

Expected Results:
Test completes successfully

Actual Results:
Upon attempting to get the first snapshot of the UI hierarchy after the app has launched and idled, the tests fail with "UI Testing Failure - Failure getting snapshot"

Assertion Failure: UI Testing Failure - Failure getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error -25201 getting snapshot for element <AXUIElement 0x145e00cb0> {pid=1648}"

Version:
Version 7.3 (7D175)

Notes:
The table view and cell is irrelevant in the attached project, the bug is just lies with the string.

Configuration:
Happens on a real iOS device or any iOS Simulator

Comments

I am getting the same error in Xcode version 8.3.2 (8E2002), but only on real device. Why ticket status is Resolved if users are still faced with this error (https://forums.developer.apple.com/message/194178) ?

failed: Failure getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error -25204 getting snapshot for element {pid=484}" UserInfo={NSLocalizedDescription=Error -25204 getting snapshot for element {pid=484}}

Please provide all steps to resolve this!

I am getting the same error in Xcode 8.1 Any resolve on this? UI Testing Failure - Failure getting snapshot Error Domain=XCTestManagerErrorDomain Code=9

By JeremiahJacquet at Nov. 6, 2016, 6:40 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!