I recently tried to integrate open feint into my app. When my app launches, the 'Welcome back player xxxx' at the bottom works so I know that open feint is working. However, when I press the button that has this linked to it
-(IBAction) leaderboard: (id) sender
{
[OpenFeint launchDashboard];
}
I get this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DemoAppViewController leaderboard]: unrecognized selector sent to instance 0x7a40250'
*** Call stack at first throw:
(
0 CoreFoundation 0x02d71919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02ebf5de objc_exception_throw + 47
2 CoreFoundation 0x02d7342b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x02ce3116 ___forwarding___ + 966
4 CoreFoundation 0x02ce2cd2 _CF_forwarding_prep_0 + 50
5 UIKit 0x00695e14 -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x0071f6c8 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00721b4a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x007206f7 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x006b92ff -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x0069b1ec -[UIApplication sendEvent:] + 447
11 UIKit 0x0069fac4 _UIApplicationHandleEvent + 7495
12 GraphicsServices 0x032f3afa PurpleEventCallback + 1578
13 CoreFoundation 0x02d52dc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x02cb3737 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x02cb09c3 __CFRunLoopRun + 979
16 CoreFoundation 0x02cb0280 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x02cb01a1 CFRunLoopRunInMode + 97
18 GraphicsServices 0x032f22c8 GSEventRunModal + 217
19 GraphicsServices 0x032f238d GSEventRun + 115
20 UIKit 0x006a3b58 UIApplicationMain + 1160
21 DemoApp 0x00004f84 main + 102
22 DemoApp 0x00004f15 start + 53
)
terminate called after throwing an instance of 'NSException'
I haven't been able to find any post on how to resolve this so any help would be greatly appreciated! Thanks in advance
From the exception it looks to me as if you tried to message your object with leaderboard when the method requires one argument and as such you should call it with one.
That is, it looks like you are doing something like this:
[someDemoAppViewControllerObject leaderboard]
When your should be doing this:
[someDemoAppViewControllerObject leaderboard:theSenderObject]
Quite often self is used as theSenderObject.
is
-(IBAction) leaderboard: (id) sender
declared in the .h file?
Related
I am having a strange problem in xcode. i created a button in xib and connected to a function. I am printing the message inside the function. That's all, when i click the button i get the following error. I tried clean and deleted app from my simulator.
-(IBAction)languageSelection:(id)sender is my function name
-[NSCFString languageSelection:]: unrecognized selector sent to instance 0x713cd40
2012-05-03 15:14:35.055 Example[33420:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString languageSelection:]: unrecognized selector sent to instance 0x713cd40'
*** Call stack at first throw:
(
0 CoreFoundation 0x02966919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02ab45de objc_exception_throw + 47
2 CoreFoundation 0x0296842b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x028d8116 ___forwarding___ + 966
4 CoreFoundation 0x028d7cd2 _CF_forwarding_prep_0 + 50
5 UIKit 0x005ece14 -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x006766c8 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00678b4a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x006776f7 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x006102ff -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x005f21ec -[UIApplication sendEvent:] + 447
11 UIKit 0x005f6ac4 _UIApplicationHandleEvent + 7495
12 GraphicsServices 0x02dedafa PurpleEventCallback + 1578
13 CoreFoundation 0x02947dc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x028a8737 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x028a59c3 __CFRunLoopRun + 979
16 CoreFoundation 0x028a5280 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x028a51a1 CFRunLoopRunInMode + 97
18 GraphicsServices 0x02dec2c8 GSEventRunModal + 217
19 GraphicsServices 0x02dec38d GSEventRun + 115
20 UIKit 0x005fab58 UIApplicationMain + 1160
21 Example 0x000023c9 main + 121
22 Example 0x00002345 start + 53
)
terminate called after throwing an instance of 'NSException'
this is perhaps you are trying to call a method languageSelection with object that is infact string, but you have passed into another object which has languageSelection method.
this is because you think the object is what you want but the pointer passed the allocated memory to string and hence it will work as string. when you try to call method it crashes because it didn't find the method in string. check your object type just before u use it anywhere
i hav this error. can anyone help me...
Call stack at first throw:
(
0 CoreFoundation 0x00dc25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f16313 objc_exception_throw + 44
2 CoreFoundation 0x00dc40bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d33966 ___forwarding___ + 966
4 CoreFoundation 0x00d33522 _CF_forwarding_prep_0 + 50
5 UIKit 0x002b24fd -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x00342799 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00344c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x003437d8 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x002d6ded -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x002b7c37 -[UIApplication sendEvent:] + 447
11 UIKit 0x002bcf2e _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x0171a992 PurpleEventCallback + 1550
13 CoreFoundation 0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00d03cf7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00d00f83 __CFRunLoopRun + 979
16 CoreFoundation 0x00d00840 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00d00761 CFRunLoopRunInMode + 97
18 GraphicsServices 0x017191c4 GSEventRunModal + 217
19 GraphicsServices 0x01719289 GSEventRun + 115
20 UIKit 0x002c0c93 UIApplicationMain + 1160
21 BasicNavigation 0x00001ea0 main + 102
22 BasicNavigation 0x00001e31 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
(gdb)
When you are getting this error?
NSInvalidArgumentException
Name of an exception that occurs when you pass an invalid argument
to a method, such as a nil pointer where a non-nil object is required.
-[NSObject(NSObject) doesNotRecognizeSelector:]
indicates that one of your objects does not recognize the selector method. You are probably calling a method using an object which does not perform the particular method. Please post your code so that you can get the exact reason.
2011-04-26 01:36:17.914 Protoype_Test1[15119:207] -[Protoype_Test1ViewController saveImage]: unrecognized selector sent to instance 0x5f60e60
2011-04-26 01:36:17.933 Protoype_Test1[15119:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Protoype_Test1ViewController saveImage]: unrecognized selector sent to instance 0x5f60e60'
*** Call stack at first throw:
(
0 CoreFoundation 0x0126cbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010615c2 objc_exception_throw + 47
2 CoreFoundation 0x0126e6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x011de366 ___forwarding___ + 966
4 CoreFoundation 0x011ddf22 _CF_forwarding_prep_0 + 50
5 UIKit 0x00366a6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x003f51b5 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x003f7647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x003f61f4 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x0038b0d1 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x0036c37a -[UIApplication sendEvent:] + 447
11 UIKit 0x00371732 _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x01a83a36 PurpleEventCallback + 1550
13 CoreFoundation 0x0124e064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x011ae6f7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x011ab983 __CFRunLoopRun + 979
16 CoreFoundation 0x011ab240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x011ab161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01a82268 GSEventRunModal + 217
19 GraphicsServices 0x01a8232d GSEventRun + 115
20 UIKit 0x0037542e UIApplicationMain + 1160
21 Protoype_Test1 0x00001c34 main + 102
22 Protoype_Test1 0x00001bc5 start + 53
)
terminate called after throwing an instance of 'NSException'
see if the IBAction of the buttons are connected properly. I guess they are not properly connected
It would be much helpful if you post your source code rather than error out come.
Anyway i think you are trying to call an instance method through class reference.
The problem is here:
[Protoype_Test1ViewController saveImage]
It should be:
[protoype_Test1ViewController saveImage]
This is a common mistake when relay much on auto complete.
I'm pushing a simple view onto a NavigationController. The view loads fine, and when I use the built-in back button, it is properly popped.
However, when I try and pop the view with my own UIButton within the view, I get a crash.
This is the action run by my UIButton:
-(IBAction)iAgreePressed {
[[self navigationController] popViewControllerAnimated:YES];}
Am I missing something obvious here?
This is the error coming back in the console:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LegalAgreementController iAgreePressed:]: unrecognized selector sent to instance 0x6169190'
*** Call stack at first throw:
(
0 CoreFoundation 0x0283ab99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0298a40e objc_exception_throw + 47
2 CoreFoundation 0x0283c6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x027ac2b6 ___forwarding___ + 966
4 CoreFoundation 0x027abe72 _CF_forwarding_prep_0 + 50
5 UIKit 0x002d67f8 -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x00361de0 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00364262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x00362e0f -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x002fa3d0 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x002dbcb4 -[UIApplication sendEvent:] + 447
11 UIKit 0x002e09bf _UIApplicationHandleEvent + 7672
12 GraphicsServices 0x02f57822 PurpleEventCallback + 1550
13 CoreFoundation 0x0281bff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x0277c807 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x02779a93 __CFRunLoopRun + 979
16 CoreFoundation 0x02779350 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x02779271 CFRunLoopRunInMode + 97
18 GraphicsServices 0x02f5600c GSEventRunModal + 217
19 GraphicsServices 0x02f560d1 GSEventRun + 115
20 UIKit 0x002e4af2 UIApplicationMain + 1160
21 WeiglWorksMobileCommander 0x00001fa2 main + 84
22 WeiglWorksMobileCommander 0x00001f45 start + 53
23 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Thank you for your time!
Method signatures don't match. The button is sending
-[LegalAgreementController iAgreePressed:]
but you defined
-[LegalAgreementController iAgreePressed] //(note one arg versus no arg)
IBActions should be defined as:
- (IBAction) someMethod:(id)sender
You don't strictly have to include that arg, but you want to for consistency.
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.
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.
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.