2009/12/14

iPhone woes (or, why the hell is my button action going to a free pointer?)

So the last day and a half I've been debugging this problem which has GOT to be something most beginning iPhone developers run into sooner or later. I had absolutely no luck coming across anything that explained this problem, so I'm posting this to help somebody else who runs into it.

When you connect events in Interface Builder to actions on your UIViewController, there's one thing in particular you want to look out for. Be sure to connect them to the right object! In my case, both my "File's owner" and view controller were the same class, AlertDetailViewController. When I dragged the event over to the resource window, I dropped it on the "AlertDetailViewController" class, when I should have dropped it on "File's owner". By putting it on the former instead of the latter, I sent the event message to an anonymous instance of the AlertDetailViewController, with the result that every time I clicked the button in question, I got a segfault in my application.

I hope that helps someone someday!

Labels: , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home