Trying to use preformSelector and getting an error - ios

I'm calling methods dynamically by name. this is the code I'm using:
NSString *methodName=[NSString stringWithFormat:#"%#HintButton",stringForPredicate];
SEL s = NSSelectorFromString(methodName);
[self performSelector:s withObject:hItem];
I Checked and s value is
AnotherSoundHintButton
I have the following method in my code:
- (void )AnotherSoundHintButton:(HintItem*) hItem {
[self PlaySound:hItem.hint];
}
but when I run my app I'm getting the following error:
2013-05-29 12:18:39.945 Game[19668:c07] -[SoundViewController AnotherSoundHintButton]: unrecognized selector sent to instance 0x8c60e90
2013-05-29 12:18:39.946 Game[19668:c07] Uncaught exception: -[SoundViewController AnotherSoundHintButton]: unrecognized selector sent to instance 0x8c60e90
2013-05-29 12:18:39.947 Game[19668:c07] Stack trace: (
0 CoreFoundation 0x01c4202e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x019b5e7e objc_exception_throw + 44
2 CoreFoundation 0x01ccd4bd -[NSObject(NSObject) doesNotRecognizeSelector:] + 253
3 CoreFoundation 0x01c31bbc ___forwarding___ + 588
4 CoreFoundation 0x01c3194e _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x019c96b0 -[NSObject performSelector:withObject:] + 70
6 Game 0x00008ab9 -[SoundViewController alertView:clickedButtonAtIndex:] + 969
7 UIKit 0x00ced0bc -[UIAlertView(Private) _buttonClicked:] + 294
8 libobjc.A.dylib 0x019c9705 -[NSObject performSelector:withObject:withObject:] + 77
9 UIKit 0x008fd2c0 -[UIApplication sendAction:to:from:forEvent:] + 96
10 UIKit 0x008fd258 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
11 UIKit 0x009be021 -[UIControl sendAction:to:forEvent:] + 66
12 UIKit 0x009be57f -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578
13 UIKit 0x009bd6e8 -[UIControl touchesEnded:withEvent:] + 546
14 UIKit 0x0092ccef -[UIWindow _sendTouchesForEvent:] + 846
15 UIKit 0x0092cf02 -[UIWindow sendEvent:] + 273
16 UIKit 0x0090ad4a -[UIApplication sendEvent:] + 436
17 UIKit 0x008fc698 _UIApplicationHandleEvent + 9874
18 GraphicsServices 0x02ab8df9 _PurpleEventCallback + 339
19 GraphicsServices 0x02ab8ad0 PurpleEventCallback + 46
20 CoreFoundation 0x01bb7bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
21 CoreFoundation 0x01bb7962 __CFRunLoopDoSource1 + 146
22 CoreFoundation 0x01be8bb6 __CFRunLoopRun + 2118
23 CoreFoundation 0x01be7f44 CFRunLoopRunSpecific + 276
24 CoreFoundation 0x01be7e1b CFRunLoopRunInMode + 123
25 GraphicsServices 0x02ab77e3 GSEventRunModal + 88
26 GraphicsServices 0x02ab7668 GSEventRun + 104
27 UIKit 0x008f9ffc UIApplicationMain + 1211
28 Game 0x00002724 main + 164
29 Game 0x00002635 start + 53
)

Try this :
NSString *methodName=[NSString stringWithFormat:#"%#HintButton:",stringForPredicate];
The colon after "HintButton" is important.

add column(:) after AnotherSoundHintButton
AnotherSoundHintButton:

Related

Xcode: Thread 1: signal SIGABRT

So, I'm having problems with my code.
It runs smoothly with iOS8 but when I run iOS7.1 simulator or run it through an iOS7.1 phone, I get this error.
*** First throw call stack:
(
0 CoreFoundation 0x004dd1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01afc8e5 objc_exception_throw + 44
2 CoreFoundation 0x0057a243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x004cd50b ___forwarding___ + 1019
4 CoreFoundation 0x004cd0ee _CF_forwarding_prep_0 + 14
5 testapp 0x00062e29 _TFC4hp2m14ViewController11viewDidLoadfS0_FT_T_ + 633
6 testapp 0x00063392 _TToFC4hp2m14ViewController11viewDidLoadfS0_FT_T_ + 34
7 UIKit 0x00d0133d -[UIViewController loadViewIfRequired] + 696
8 UIKit 0x00d015d9 -[UIViewController view] + 35
9 UIKit 0x00c21267 -[UIWindow addRootViewControllerViewIfPossible] + 66
10 UIKit 0x00c215ef -[UIWindow _setHidden:forced:] + 312
11 UIKit 0x00c2186b -[UIWindow _orderFrontWithoutMakingKey] + 49
12 UIKit 0x00c2c3c8 -[UIWindow makeKeyAndVisible] + 65
13 UIKit 0x00bdcbc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
14 UIKit 0x00be1667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
15 UIKit 0x00bf5f92 -[UIApplication handleEvent:withNewEvent:] + 3517
16 UIKit 0x00bf6555 -[UIApplication sendEvent:] + 85
17 UIKit 0x00be3250 _UIApplicationHandleEvent + 683
18 GraphicsServices 0x037c2f02 _PurpleEventCallback + 776
19 GraphicsServices 0x037c2a0d PurpleEventCallback + 46
20 CoreFoundation 0x00458ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
21 CoreFoundation 0x004589db __CFRunLoopDoSource1 + 523
22 CoreFoundation 0x0048368c __CFRunLoopRun + 2156
23 CoreFoundation 0x004829d3 CFRunLoopRunSpecific + 467
24 CoreFoundation 0x004827eb CFRunLoopRunInMode + 123
25 UIKit 0x00be0d9c -[UIApplication _run] + 840
26 UIKit 0x00be2f9b UIApplicationMain + 1225
27 testapp 0x0006cd9e top_level_code + 78
28 testapp 0x0006cddb main + 43
29 libdyld.dylib 0x023db6d9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
The error occurs at the first line of appdelegate:
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
My app imports corelocation, foundation and contactlist.
Check all the methods called in your ViewController (viewDidLoad method) you probably have a selector only available on iOS8.
To check the availability you can just right click on the method and check the documentation.
Here is an example for the showViewController:sender: method.

Crash app libc++abi.dylib (Admob)

Hello have crash app in IOS
This log:
2015-01-15 13:23:32.490 App[23898:1611888] <Google> Category methods are not loaded. Make sure you link the Google Mobile Ads library using one of the -ObjC, -force_load, or -all_load linker flags. See https://developers.google.com/mobile-ads-sdk/docs/#ios for more information.
2015-01-15 13:23:34.526 App[23898:1611888] registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.
2015-01-15 13:23:34.802 App[23898:1611888] +[NSDecimalNumber gad_negativeOne]: unrecognized selector sent to class 0x7d7400
2015-01-15 13:23:34.805 App[23898:1611888] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSDecimalNumber gad_negativeOne]: unrecognized selector sent to class 0x7d7400'
*** First throw call stack:
(
0 CoreFoundation 0x03278946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x02be0a97 objc_exception_throw + 44
2 CoreFoundation 0x03280465 +[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x031c93e7 ___forwarding___ + 1047
4 CoreFoundation 0x031c8fae _CF_forwarding_prep_0 + 14
5 App 0x000872ea -[GADStatisticDictionary decrementNumberForKey:shouldNotifyDelegate:] + 58
6 App 0x0007cc75 -[GADApplication init] + 512
7 App 0x0007ca45 __35+[GADApplication sharedApplication]_block_invoke + 55
8 libdispatch.dylib 0x03ecde2f _dispatch_client_callout + 14
9 libdispatch.dylib 0x03eb876c dispatch_once_f + 363
10 libdispatch.dylib 0x03eb85fc dispatch_once + 31
11 App 0x0007ca0c +[GADApplication sharedApplication] + 113
12 App 0x000780cd +[GADSlot initialize] + 67
13 libobjc.A.dylib 0x02be1461 _class_initialize + 576
14 libobjc.A.dylib 0x02be9fe5 lookUpImpOrForward + 339
15 libobjc.A.dylib 0x02be9e8d _class_lookupMethodAndLoadCache3 + 55
16 libobjc.A.dylib 0x02bf412f objc_msgSend + 139
17 App 0x00075f6a -[GADBannerView commonInitWithAdSize:] + 42
18 App 0x0007626e -[GADBannerView initWithCoder:] + 163
19 UIKit 0x00c5205e -[UIClassSwapper initWithCoder:] + 239
20 UIKit 0x00de7f1a UINibDecoderDecodeObjectForValue + 739
21 UIKit 0x00de7c2f -[UINibDecoder decodeObjectForKey:] + 371
22 UIKit 0x00c51bf1 -[UIRuntimeConnection initWithCoder:] + 189
23 UIKit 0x00de7f1a UINibDecoderDecodeObjectForValue + 739
24 UIKit 0x00de811c UINibDecoderDecodeObjectForValue + 1253
25 UIKit 0x00de7c2f -[UINibDecoder decodeObjectForKey:] + 371
26 UIKit 0x00c50ea7 -[UINib instantiateWithOwner:options:] + 1164
27 UIKit 0x00a73624 -[UIViewController _loadViewFromNibNamed:bundle:] + 270
28 UIKit 0x00a73dbb -[UIViewController loadView] + 295
29 UIKit 0x00a73fef -[UIViewController loadViewIfRequired] + 78
30 UIKit 0x00a74595 -[UIViewController view] + 35
31 UIKit 0x0096b825 -[UIWindow addRootViewControllerViewIfPossible] + 66
32 UIKit 0x0096bc99 -[UIWindow _setHidden:forced:] + 287
33 UIKit 0x0096bf50 -[UIWindow _orderFrontWithoutMakingKey] + 49
34 UIKit 0x0097a28d -[UIWindow makeKeyAndVisible] + 80
35 UIKit 0x00917776 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3108
36 UIKit 0x0091ac0d -[UIApplication _runWithMainScene:transitionContext:completion:] + 1639
37 UIKit 0x009337d0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
38 UIKit 0x0091981f -[UIApplication workspaceDidEndTransaction:] + 155
39 FrontBoardServices 0x05b799de __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
40 FrontBoardServices 0x05b7946f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
41 FrontBoardServices 0x05b8b425 __31-[FBSSerialQueue performAsync:]_block_invoke + 26
42 CoreFoundation 0x0319c1c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
43 CoreFoundation 0x03191ad3 __CFRunLoopDoBlocks + 195
44 CoreFoundation 0x03191238 __CFRunLoopRun + 936
45 CoreFoundation 0x03190bcb CFRunLoopRunSpecific + 443
46 CoreFoundation 0x031909fb CFRunLoopRunInMode + 123
47 UIKit 0x009191e4 -[UIApplication _run] + 571
48 UIKit 0x0091c8b6 UIApplicationMain + 1526
49 App 0x0005991d main + 141
50 libdyld.dylib 0x03ef9ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Try to add -ObjC to Other Linker Flags in the Build Settings tab.

Crash when tapping UITableView (iOS)

I`m using cocos2d-x and UIKit and I have such crash.Doest anyone has any ideas? I would be very happy to listen to anything.
0 libobjc.A.dylib 0x3b0985cc objc_msgSend + 44
1 CoreFoundation 0x33411f60 __CFBasicHashRehash + 1612
2 CoreFoundation 0x3333bfe8 CFBasicHashRemoveValue + 2764
3 CoreFoundation 0x3333fe40 CFRunLoopRemoveTimer + 152
4 CoreFoundation 0x3333fd16 CFRunLoopTimerInvalidate + 346
5 UIKit 0x353162fc -[UIDelayedAction unschedule] + 32
6 UIKit 0x3531bca8 -[UIScrollViewDelayedTouchesBeganGestureRecognizer clearTimer] + 32
7 UIKit 0x3531bb62 -[UIScrollViewDelayedTouchesBeganGestureRecognizer touchesBegan:withEvent:] + 30
8 UIKit 0x3521307e -[UIWindow _sendGesturesForEvent:] + 406
9 UIKit 0x35212dae -[UIWindow sendEvent:] + 86
10 UIKit 0x352007fc -[UIApplication sendEvent:] + 376
11 UIKit 0x35200116 _UIApplicationHandleEvent + 6150
12 GraphicsServices 0x36f035a0 _PurpleEventCallback + 588
13 CoreFoundation 0x333cd680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
14 CoreFoundation 0x333ccee4 __CFRunLoopDoSources0 + 208
15 CoreFoundation 0x333cbcb2 __CFRunLoopRun + 642
16 CoreFoundation 0x3333eeb8 CFRunLoopRunSpecific + 352
17 CoreFoundation 0x3333ed44 CFRunLoopRunInMode + 100
18 GraphicsServices 0x36f022e6 GSEventRunModal + 70
19 UIKit 0x352542fc UIApplicationMain + 1116

iOS objc_msgSend crash, with no report or warning given

I am testing my app out, pushing it pretty hard, and I'm getting it to crash (black screen, image doesn't save, drops back to springboard). However, I get no crash reports logged in the console. When I test using profiler all I get is a message saying the target died, but it gives no clues.
In the organiser I got the device crash logs which gives me this which I believe is telling me I'm sending a message to something I've released (objc-msgSend + 22)? Am I on the right track here?
---
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x576e6f69
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x34f8ef7e objc_msgSend + 22
1 CoreFoundation 0x371d7e90 CFRetain + 76
2 CoreFoundation 0x371e1b74 +[__NSArrayI __new::] + 48
3 CoreFoundation 0x371e1a8e -[__NSPlaceholderArray initWithObjects:count:] + 294
4 CoreFoundation 0x371e9394 -[NSArray initWithArray:range:copyItems:] + 756
5 CoreFoundation 0x371fcd5a +[NSArray arrayWithArray:] + 66
6 AVFoundation 0x335da766 -[AVCaptureSession outputs] + 146
7 AVFoundation 0x335de26e -[AVCaptureSession _doDidStop:] + 38
8 AVFoundation 0x335dfaea -[AVCaptureSession _handleNotification:payload:] + 2002
9 AVFoundation 0x335d8af6 avcaptureSessionFigRecorderNotification + 1202
10 AVFoundation 0x335fafd8 AVCMNotificationDispatcherCallback + 184
11 CoreFoundation 0x3725b7c8 __CFNotificationCenterAddObserver_block_invoke_0 + 116
12 CoreFoundation 0x3725b540 ___CFXNotificationPost_block_invoke_0 + 64
13 CoreFoundation 0x371e7090 _CFXNotificationPost + 1400
14 CoreFoundation 0x371ef1c6 CFNotificationCenterPostNotification + 102
15 CoreMedia 0x366eeeb0 CMNotificationCenterPostNotification + 112
16 Celestial 0x374b08a2 FigRecorderRemoteCallbacksServer_NotificationIsPending + 478
17 Celestial 0x374b06ba _XNotificationIsPending + 54
18 Celestial 0x374b0678 figrecordercallbacks_server + 92
19 Celestial 0x374af642 remrec_ClientPortCallBack + 146
20 CoreFoundation 0x37258f0c __CFMachPortPerform + 356
21 CoreFoundation 0x3726351c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
22 CoreFoundation 0x372634be __CFRunLoopDoSource1 + 134
23 CoreFoundation 0x3726230c __CFRunLoopRun + 1364
24 CoreFoundation 0x371e549e CFRunLoopRunSpecific + 294
25 CoreFoundation 0x371e5366 CFRunLoopRunInMode + 98
26 AVFoundation 0x335ef4d0 -[AVRunLoopCondition _waitInMode:untilDate:] + 348
27 AVFoundation 0x335ef36c -[AVRunLoopCondition waitUntilDate:inMode:] + 20
28 AVFoundation 0x335dc13a -[AVCaptureSession _stopPreviewing] + 438
29 AVFoundation 0x335dc2d6 -[AVCaptureSession _setRunning:] + 166
30 AVFoundation 0x335dbe42 -[AVCaptureSession stopRunning] + 274
31 zApp 0x0007e1ce 0x79000 + 20942
32 UIKit 0x30fa5b8e -[UIViewController _setViewAppearState:isAnimating:] + 138
33 UIKit 0x30fff8a8 -[UIViewController beginAppearanceTransition:animated:] + 184
34 UIKit 0x310468be -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 4098
35 UIKit 0x31045360 -[UIViewController presentViewController:withTransition:completion:] + 3116
36 UIKit 0x310a06a0 -[UIViewController presentModalViewController:animated:] + 24
37 CoreFoundation 0x371e93f6 -[NSObject performSelector:withObject:withObject:] + 46
38 UIKit 0x30f7ee00 -[UIApplication sendAction:to:from:forEvent:] + 56
39 UIKit 0x30f7edbc -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24
40 UIKit 0x30f7ed9a -[UIControl sendAction:to:forEvent:] + 38
41 UIKit 0x30f7eb0a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 486
42 UIKit 0x30f7f442 -[UIControl touchesEnded:withEvent:] + 470
43 UIKit 0x30f7d924 -[UIWindow _sendTouchesForEvent:] + 312
44 UIKit 0x30f7d312 -[UIWindow sendEvent:] + 374
45 UIKit 0x30f6368e -[UIApplication sendEvent:] + 350
46 UIKit 0x30f62f34 _UIApplicationHandleEvent + 5820
47 GraphicsServices 0x339a5224 PurpleEventCallback + 876
48 CoreFoundation 0x3726351c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
49 CoreFoundation 0x372634be __CFRunLoopDoSource1 + 134
50 CoreFoundation 0x3726230c __CFRunLoopRun + 1364
51 CoreFoundation 0x371e549e CFRunLoopRunSpecific + 294
52 CoreFoundation 0x371e5366 CFRunLoopRunInMode + 98
53 GraphicsServices 0x339a4432 GSEventRunModal + 130
54 UIKit 0x30f91cce UIApplicationMain + 1074
55 zApp 0x0007ffa6 0x79000 + 28582
56 zApp 0x0007a680 0x79000 + 5760
If you suspect that you are overreleasing something, try running your app with NSZombie enabled. (how to enable NSZombie)
You can set exception breakpoint to print backtrace in console.
sometimes that happens when you set an object as an observer for notifications, like
[[NSNotificationCenter defaultCenter] addObserver //details
and don't remove it from the observers list when it's released.
the system tries to send a message to it, and the app crashes because it's not there.
try adding
[[NSNotificationCenter defaultCenter] removeObserver:self];
in the dealloc function. (even if you're working with arc, create a dealloc function, and write that in it).
good luck

Understanding the stack trace

I'm trying to better understand what the stack trace means. I have a two specific questions in this case.
1 - Does this stack trace mean that the method setOutcome: is unrecognized by an instance of a Task object?
2 - Can a method be unrecognized if the parameter passed in does not match the class of the expected parameter?
012-03-30 01:53:57.988 Arbonne[17625:15203] -[Task setOutcome:]: unrecognized selector sent to instance 0x81b6b60
2012-03-30 01:53:58.151 Arbonne[17625:15203] ERROR main [Line 20] Uncaught exception: -[Task setOutcome:]: unrecognized selector sent to instance 0x81b6b60
2012-03-30 01:53:58.154 Arbonne[17625:15203] ERROR main [Line 21] Stack trace: (
0 CoreFoundation 0x01d8903e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x01f1acd6 objc_exception_throw + 44
2 CoreFoundation 0x01d8acbd -[NSObject doesNotRecognizeSelector:] + 253
3 CoreFoundation 0x01cefed0 ___forwarding___ + 432
4 CoreFoundation 0x01cefcb2 _CF_forwarding_prep_0 + 50
5 Arbonne 0x00030d5d -[TaskViewController addTask:] + 237
6 CoreFoundation 0x01d8ae99 -[NSObject performSelector:withObject:withObject:] + 73
7 UIKit 0x0081a14e -[UIApplication sendAction:to:from:forEvent:] + 96
8 UIKit 0x00a58a0e -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 145
9 CoreFoundation 0x01d8ae99 -[NSObject performSelector:withObject:withObject:] + 73
10 UIKit 0x0081a14e -[UIApplication sendAction:to:from:forEvent:] + 96
11 UIKit 0x0081a0e6 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
12 UIKit 0x008c0ade -[UIControl sendAction:to:forEvent:] + 66
13 UIKit 0x008c0fa7 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
14 UIKit 0x008c0266 -[UIControl touchesEnded:withEvent:] + 549
15 UIKit 0x0083f3c0 -[UIWindow _sendTouchesForEvent:] + 513
16 UIKit 0x0083f5e6 -[UIWindow sendEvent:] + 273
17 UIKit 0x00825dc4 -[UIApplication sendEvent:] + 464
18 UIKit 0x00819634 _UIApplicationHandleEvent + 8196
19 GraphicsServices 0x02653ef5 PurpleEventCallback + 1274
20 CoreFoundation 0x01d5d195 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
21 CoreFoundation 0x01cc1ff2 __CFRunLoopDoSource1 + 146
22 CoreFoundation 0x01cc08da __CFRunLoopRun + 2218
23 CoreFoundation 0x01cbfd84 CFRunLoopRunSpecific + 212
24 CoreFoundation 0x01cbfc9b CFRunLoopRunInMode + 123
25 GraphicsServices 0x026527d8 GSEventRunModal + 190
26 GraphicsServices 0x0265288a GSEventRun + 103
27 UIKit 0x00817626 UIApplicationMain + 1163
28 Arbonne 0x0000324f main + 127
29 Arbonne 0x00002c55 start + 53
Yes
No, but you would probably get an unrecognized selector error from within that method once you try to do something with it - e.g. if you are expecting an array and you pass in a string, then try to get an object from your "array", you will get an error at that point.

Resources