SIGABRT Error on Button Click xcode - iphone

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

Related

Terminating app due to uncaught exception 'NSInvalidArgumentException',

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.

How to debug 'unrecognized selector sent to instance' error in Xcode?

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.

unrecognized selector sent to instance

I have added a tabbarcontroller on window and a button on view respective to first tab.
As I run the app and press the button, the app is crashing with this msg:
2011-05-20 18:56:46.258 FeatureList[3395:207] -[UIViewController barButtonPressed:]: unrecognized selector sent to instance 0x4b22520
2011-05-20 18:56:46.262 FeatureList[3395:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController barButtonPressed:]: unrecognized selector sent to instance 0x4b22520'
*** Call stack at first throw:
(
0 CoreFoundation 0x00da9be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00efe5c2 objc_exception_throw + 47
2 CoreFoundation 0x00dab6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d1b366 ___forwarding___ + 966
4 CoreFoundation 0x00d1af22 _CF_forwarding_prep_0 + 50
5 UIKit 0x002b2a6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x003411b5 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00343647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x003421f4 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x002d70d1 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x002b837a -[UIApplication sendEvent:] + 447
11 UIKit 0x002bd732 _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x016dfa36 PurpleEventCallback + 1550
13 CoreFoundation 0x00d8b064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00ceb6f7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00ce8983 __CFRunLoopRun + 979
16 CoreFoundation 0x00ce8240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00ce8161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x016de268 GSEventRunModal + 217
19 GraphicsServices 0x016de32d GSEventRun + 115
20 UIKit 0x002c142e UIApplicationMain + 1160
21 FeatureList 0x000024fc main + 102
22 FeatureList 0x0000248d start + 53
23 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
kill
quit
The Debugger has exited with status 0.(gdb)
This happens when you try to call a method that doesn't exist. It looks like you've set up your button to send a message to the view controller (barButtonPressed:), but you may not have implemented the method if your view controller. Or you may have misspelled the method name or not included the argument in the method implementation.
Post your view controller code.
It looks like the button is trying to call barButtonPressed: on the view controller, but that method doesn't exist. Are you sure you don't get warnings during compilation regarding missing methods? My guess is you're not setting the view controller class correctly in a nib file.
Have you implemented barButtonPressed:? Are you sure you need the colon? Try barButtonPressed as the selector name instead.
This is an old question, but I think I know what happened. Notice how the error message says UIViewController instead of TodayDeal; he needed to change the Xib's file owner from a default UIViewController to TodayDeal

App crashes when I pop a view from NavigationController using a UIButton

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.

Getting a crash when I launch OpenFeint dashboard

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?