You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 'public func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool' method when implemented in a class that conforms UITableViewDelegate gets sometimes called by the system with nil for the 'indexPath' parameter.
As the indexPath parameter is bridged from Objective-C as implicitly unwrapped, this causes a crash and makes the test fail with the following error:
Assertion Failure: UI Testing Failure - Failure getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error -25204 getting snapshot for element AXUIElement 0x7f84b5c0ea40 {pid=32894}" UserInfo={NSLocalizedDescription=Error -25204 getting snapshot for element AXUIElement 0x7f84b5c0ea40 {pid=32894}}
Additional notes:
Interestingly, on iOS 9 simulator this works just fine, no crashes. It's the iOS 10 and above that's problematic
Expected results:
This problematic UITableViewDelegate's method should either not be called at all with indexPath=nil or the indexPath type should be marked as optional:
Description
The 'public func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool' method when implemented in a class that conforms UITableViewDelegate gets sometimes called by the system with nil for the 'indexPath' parameter.
As the indexPath parameter is bridged from Objective-C as implicitly unwrapped, this causes a crash and makes the test fail with the following error:
Assertion Failure: UI Testing Failure - Failure getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error -25204 getting snapshot for element AXUIElement 0x7f84b5c0ea40 {pid=32894}" UserInfo={NSLocalizedDescription=Error -25204 getting snapshot for element AXUIElement 0x7f84b5c0ea40 {pid=32894}}
App's backtrace on crash:
(lldb) thread backtrace
if let
andguard let
to assign toself
in failable value type initializers #1: tid = 0x128eaa, 0x000000010c776c3a libswiftFoundation.dylib`static Foundation.IndexPath._unconditionallyBridgeFromObjectiveC (Swift.Optional<__ObjC.NSIndexPath>) -> Foundation.IndexPath + 42, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)static Foundation.IndexPath._unconditionallyBridgeFromObjectiveC (Swift.Optional<__ObjC.NSIndexPath>) -> Foundation.IndexPath + 42 frame #1: 0x0000000108443241 Static
@objc DataSource.tableView(UITableView, canPerformAction : Selector, forRowAt : IndexPath, withSender : Any?) -> Bool + 97 at DataSource.swift:0frame 22108390: Swift 2.0b4: Allow assignment of nil to self in failable initializers to indicate failure #2: 0x00000001095aea31 UIKit
-[UITableView _canPerformAction:forCell:sender:] + 169 frame #3: 0x00000001098017c6 UIKit
-[UITableViewCell canPerformAction:withSender:] + 86frame 22108127: Apple Music: CarPlay does not show the For You Playlists #4: 0x00000001210a5fc9 UIKit
-[UIResponder(UITextAccessibilityUtilities) _accessibilityHasTextOperations] + 100 frame #5: 0x000000012107bb7c UIKit
-[UITableViewCellAccessibilityElement _accessibilityHasTextOperations] + 48frame 22108095: Changing account in Music app requires force-quit #6: 0x00000001211f09ec UIAccessibility
-[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 5945 frame #7: 0x000000012120bc04 UIAccessibility
_accessibilityAttributesForObject + 767frame 22107434: Providing Generic Generator for protocol intermittently crashes compiler #8: 0x000000012120b5e8 UIAccessibility
-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 1736 frame #9: 0x000000012120cf96 UIAccessibility
-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 557frame 22107245: Xcode 7 beta 4 (7A165t) Interface Builder ignores background color set on UITableView #10: 0x00000001211eec0a UIAccessibility
-[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 7903 frame #11: 0x00000001211d8856 UIAccessibility
_copyParameterizedAttributeValueCallback + 211frame 22106516: watchOS 2 Beta 4: Can’t Import CoreText #12: 0x0000000120869532 AXRuntime
_AXXMIGCopyParameterizedAttributeValue + 216 frame #13: 0x0000000120863f1c AXRuntime
_XCopyParameterizedAttributeValue + 440frame 22105625: Mac OS X 10.11: Battery status alwasy shows "20:00 Remaining" #14: 0x0000000120872de5 AXRuntime
mshMIGPerform + 266 frame #15: 0x00000001064e93d9 CoreFoundation
CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 41frame 22103992: Stack implemented with enum causes Abort trap: 6 #16: 0x00000001064e9351 CoreFoundation
__CFRunLoopDoSource1 + 465 frame #17: 0x00000001064e1435 CoreFoundation
__CFRunLoopRun + 2389frame 22103156: News app interface sometimes not visible or incorrect #18: 0x00000001064e0884 CoreFoundation
CFRunLoopRunSpecific + 420 frame #19: 0x000000010e5bda6f GraphicsServices
GSEventRunModal + 161frame 22102128: Face detection accuracy is bad #20: 0x000000010943dc68 UIKit
UIApplicationMain + 159 frame #21: 0x000000010462c95f GoOut
main + 111 at AppDelegate.swift:47frame 22098492: Xcode-beta (7A165t): UI Tests: secureTextFields are duplicated #22: 0x000000010cb7e68d libdyld.dylib
start + 1 frame #23: 0x000000010cb7e68d libdyld.dylib
start + 1Additional notes:
Interestingly, on iOS 9 simulator this works just fine, no crashes. It's the iOS 10 and above that's problematic
Expected results:
This problematic UITableViewDelegate's method should either not be called at all with indexPath=nil or the indexPath type should be marked as optional:
'public func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath?, withSender sender: Any?) -> Bool'
Product Version: 10.0
Created: 2017-03-31T18:49:26.449740
Originated: 2017-03-31T00:00:00
Open Radar Link: http://www.openradar.me/31375101
The text was updated successfully, but these errors were encountered: