views:

91

answers:

3

Hi,

I am learning how to develop iPhone applications and I ran into an interesting problem. In my view controller class, I have a an int variable that I @synthesize and overload the setter (though) this is not needed. When I run the application, I get this trace back:

* Call stack at first throw: (

0   CoreFoundation                      0x024e0919 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x0262e5de objc_exception_throw + 47
2   CoreFoundation                      0x024e242b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3   CoreFoundation                      0x02452116 ___forwarding___ + 966
4   CoreFoundation                      0x02451cd2 _CF_forwarding_prep_0 + 50
5   Awesome App                         0x00001ff1 -[Controller refreshView] + 69
6   Awesome App                         0x00002180 -[Controller awakeFromNib] + 133
7   UIKit                               0x004a3924 -[UINib instantiateWithOwner:options:] + 1556
8   UIKit                               0x004a54b5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9   UIKit                               0x002b49bb -[UIApplication _loadMainNibFile] + 172
10  UIKit                               0x002b590d -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 198
11  UIKit                               0x002bf452 -[UIApplication handleEvent:withNewEvent:] + 1958
12  UIKit                               0x002b8074 -[UIApplication sendEvent:] + 71
13  UIKit                               0x002bcac4 _UIApplicationHandleEvent + 7495
14  GraphicsServices                    0x02d46afa PurpleEventCallback + 1578
15  CoreFoundation                      0x024c1dc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16  CoreFoundation                      0x02422737 __CFRunLoopDoSource1 + 215
17  CoreFoundation                      0x0241f9c3 __CFRunLoopRun + 979
18  CoreFoundation                      0x0241f280 CFRunLoopRunSpecific + 208
19  CoreFoundation                      0x0241f1a1 CFRunLoopRunInMode + 97
20  UIKit                               0x002b5226 -[UIApplication _run] + 625
21  UIKit                               0x002c0b58 UIApplicationMain + 1160
22  Awesome App                         0x00001e4c main + 102
23  Awesome App                         0x00001ddd start + 53

) terminate called after throwing an instance of 'NSException' Program received signal: “SIGABRT”.

My attention got drawn to line 2. This happens when I try to assign an int value to my class iVar. Please can you tell me what the problem is and how to fix this?

Thanks a million.

+4  A: 

Well, yeah. The default implementation of doesNotRecognizeSelector: is supposed to kill your program. That's not the problem. The problem is that you're sending an object a message it can't respond to. In this case, it looks like Controller can't respond to the message refreshView.

Chuck
`refreshView` is actually the last method call successfully sent. That method (or a method tail-called from it) then called something that isn't implemented....
bbum
It was something in the refreshView function. My views were messing with the data behind the controller's back and things got ugly. I got it fixed though. Thanks.
Yasky
+2  A: 

Let the exception be thrown and let the program crash on the uncaught exception. The exception contains all the information you need. You should see a log line that identifies the target of the method invocation and what method (that doesn't exist) was trying to be invoked.

bbum
A: 

Did you try going into your .h file, and defining the method there?

NSArray