views:

88

answers:

2

I have a crash, and I can't see why it's occurring. I'd like to get more info on it.

The method that this is crashing in is:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

when I execute this line of code during debug step through:

[self.nextResponder manageTouches:touches];

this is displayed in the file history list:

asm__TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__ 0x01c1c000:1

The manageTouches method is in the parent object (a view controller).

Any tips for how to resolve are appreciated // :)

+1  A: 

Use the Objective-C @try ... @except syntax. You can read up on it in the Exception Handling section of the Objective-C 2.0 language documentation.

Gordon Worley
I think you mean @try...@catch.
Ben Gottlieb
Thanks, a good way to go, but I'm lacking enough clarity about what it is that is going wrong to manage try and catch effectively yet. An excellent suggestion though.
Spanky
A: 

There could be a difference between the parent object (your view controller) and the nextResponder you are sending the message to. In the debugger you can make sure the pointers are the same. I would imagine there is some discrepancy here between the responder chain and the view hierarchy ownership chain.

fbrereto
Makes sense, any idea how to check if that is the case?
Spanky
Actually, no it doesn't come to think of it. The child view is specifically added as a subview of the parent in my code. I can verify this in other areas within too, where I am adding objects of the same class as subviews but handling their events internally rather than through nextResponder. This is why I'm confused... not seeing enough of what is going on behind nextResponder. Any idea how to get under the hood of that? Thanks // :)
Spanky
The view controller that owns the view is not the same as the parent of the view in terms of the view hierarchy. I would double check the `self.superview` value in your view, compare it against the `nextResponder`, and make sure each structure is as you believe it to be.
fbrereto
Yup, great! Thanks.
Spanky