Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using "convert(:to:)" #236

Closed
PreSwift opened this issue May 4, 2017 · 1 comment
Closed

Crash when using "convert(:to:)" #236

PreSwift opened this issue May 4, 2017 · 1 comment

Comments

@PreSwift
Copy link

PreSwift commented May 4, 2017

code like this:

func touchEvent(sender: ASButtonNode) {
        if let indexPath = tableNode.indexPathForRow(at: sender.view.convert(sender.bounds.origin, to: tableNode.view)) {
           ......
        }
    }

console:

2017-05-04 16:12:57.212843+0800 xxxxxxxx[1313:252058] *** Assertion failure in ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *__strong _Nonnull, ASDisplayNode *__strong _Nonnull)(), /Users/wes709/Desktop/xxxxxxxx/Pods/Texture/Source/ASDisplayNodeExtras.mm:283
2017-05-04 16:12:57.222448+0800 xxxxxxxx[1313:252058] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not find a common ancestor between node1: <ASButtonNode: 0x101457130> and node2: <ASTableNode: 0x10161ea10>'
*** First throw call stack:
(0x190ecafd8 0x18f92c538 0x190ecaeac 0x19196277c 0x1004e7854 0x1004cd104 0x1004cd75c 0x100104180 0x100105194 0x10048e75c 0x10048c91c 0x10048e3a8 0x10048b8c4 0x100434fa0 0x1975c346c 0x1975bf7b8 0x190e789a0 0x190e76628 0x190e76a74 0x190da6d94 0x192810074 0x19705f130 0x1001171a0 0x18fdb559c)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Instead use sender.view.convert(sender.bounds.origin, to: tableNode.view) to get the indexPath in the table node's coordinate system, that can get the right consequence.

@maicki
Copy link
Contributor

maicki commented Jun 20, 2017

@PreSwift Hey! The answer in #58 should resolve your issue too. Thanks!

@maicki maicki closed this as completed Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants