UIKit -[UIApplication sendAction:to:from:forEvent:] crash - ios

I ran into a very unusual problem.. i got a crash on UIKit.. first time i have faced something like this.. Please can anybody guide my in this..
This is the crash log that i got.
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x1161a18c
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x386fcb66 objc_msgSend + 5
1 UIKit 0x30b5dda3 -[UIApplication sendAction:to:from:forEvent:] + 90
2 UIKit 0x30cc5615 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 120
3 UIKit 0x30b5dda3 -[UIApplication sendAction:to:from:forEvent:] + 90
4 UIKit 0x30b5dd3f -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 38
5 UIKit 0x30b5dd13 -[UIControl sendAction:to:forEvent:] + 46
6 UIKit 0x30b49743 -[UIControl _sendActionsForEvents:withEvent:] + 374
7 UIKit 0x30b5d75b -[UIControl touchesEnded:withEvent:] + 594
8 UIKit 0x30b5d425 -[UIWindow _sendTouchesForEvent:] + 528
9 UIKit 0x30b58451 -[UIWindow sendEvent:] + 832
10 UIKit 0x30b2dd79 -[UIApplication sendEvent:] + 196
11 UIKit 0x30b2c569 _UIApplicationHandleEventQueue + 7116
12 CoreFoundation 0x2e36ff1f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
13 CoreFoundation 0x2e36f3e7 __CFRunLoopDoSources0 + 206
14 CoreFoundation 0x2e36dbd7 __CFRunLoopRun + 630
15 CoreFoundation 0x2e2d8471 CFRunLoopRunSpecific + 524
16 CoreFoundation 0x2e2d8253 CFRunLoopRunInMode + 106
17 GraphicsServices 0x330122eb GSEventRunModal + 138
18 UIKit 0x30b8d845 UIApplicationMain + 1136
19 TradeMate 0x0008f2bf main (main.m:16)

You are crashing in objc_msgSend. This means (as explained in this famous article) that the receiver has gone missing. In this case it appears that the user has tapped a button which sends an action message to a target, but the target object has gone out of existence.

Make sure the receiver or the object which receives the events is declared strong.
You may not even get the crash log to figure out what what went wrong :)
If you are getting something like above check if the object is declared strong. That should solve the issue

Related

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000002 on UITableView reloadData

I've had this problem for a while and it's driving me nuts. This is reported by Crashlytics but only for a few users. I'm unable to recreate the problem myself.
I'm using a SplitViewController and this occurs after a user adds data within a UIViewController and touch the save button, which then returns to the SplitViewController to perform the method 'saveItemEntry' shown below.
I've tried a suggestion from a previous post which was to wrap the [self.tableView reloadData] with dispatch_async(dispatch_get_main_queue(), ^(void), but that actually made it worse. It isn't like the data takes ages to load, it doesn't, so I can't see that multi-tasking will help, but I'm open to advice on whether I should be doing that.
I'm really not clear on how to interperupt the crash info. If someone can and can suggest what might be causing this that would be awesome.
If more info is needed please let me know.
Here's the crash details:
Here's the Raw stuff..
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x20407ae2 objc_msgSend + 1
1 CoreFoundation 0x20b8391b -[NSDictionary descriptionWithLocale:indent:] + 310
2 Foundation 0x2136fe2d _NSDescriptionWithLocaleFunc + 60
3 CoreFoundation 0x20c011a3 __CFStringAppendFormatCore + 7986
4 CoreFoundation 0x20bff255 _CFStringCreateWithFormatAndArgumentsAux2 + 80
5 CoreFoundation 0x20c17559 _CFLogvEx2 + 96
6 CoreFoundation 0x20c179af _CFLogvEx3 + 118
7 Foundation 0x214374f7 _NSLogv + 126
8 Foundation 0x2137e79d NSLog + 28
9 UIKit 0x24eac5fb -[UITableView reloadData] + 1818
10 Simple Meeting Minutes 0xfb859 -[MMDetailTableVC saveItemEntry:] (MMDetailTableVC.m:1423)
11 Simple Meeting Minutes 0x10becf -[MMItemViewController saveButtonAction:] (MMItemViewController.m:526)
12 UIKit 0x24dfd771 -[UIApplication sendAction:to:from:forEvent:] + 80
13 UIKit 0x24f7ec71 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 140
14 UIKit 0x24dfd771 -[UIApplication sendAction:to:from:forEvent:] + 80
15 UIKit 0x24dfd701 -[UIControl sendAction:to:forEvent:] + 64
16 UIKit 0x24de561f -[UIControl _sendActionsForEvents:withEvent:] + 446
17 UIKit 0x24de574b -[UIControl _sendActionsForEvents:withEvent:] + 746
18 UIKit 0x24dfd051 -[UIControl touchesEnded:withEvent:] + 616
19 UIKit 0x24dfccbf -[UIWindow _sendTouchesForEvent:] + 646
20 UIKit 0x24df55d7 -[UIWindow sendEvent:] + 642
21 UIKit 0x24dc6119 -[UIApplication sendEvent:] + 204
22 UIKit 0x24dc4757 _UIApplicationHandleEventQueue + 5134
23 CoreFoundation 0x20bf1257 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
24 CoreFoundation 0x20bf0e47 __CFRunLoopDoSources0 + 454
25 CoreFoundation 0x20bef1af __CFRunLoopRun + 806
26 CoreFoundation 0x20b41bb9 CFRunLoopRunSpecific + 516
27 CoreFoundation 0x20b419ad CFRunLoopRunInMode + 108
28 GraphicsServices 0x21dbbaf9 GSEventRunModal + 160
29 UIKit 0x24e2dfb5 UIApplicationMain + 144
30 Simple Meeting Minutes 0xf5d6f main (main.m:16)
31 libdispatch.dylib 0x207f4873 (Missing)
and here's my code in this particular area..
- (void)saveItemEntry:(MMitem *)item{
if (item)
{
// save item to the sqlite3 database file
NSString *resultStr = [self.meetingModel saveItem:item];
if ([resultStr isEqualToString:#"OK"])
{
// all good so close form and refresh data
[self dismissViewControllerAnimated:NO completion:nil];
[self.tableView reloadData];
// or if there is an error result then display message
}
else if ([resultStr isEqualToString:#"DescriptionNotesMissing"])
{
[self showAlert:#"Missing Description or Notes" :#"An Item Description or Notes is required" :0];
[self.itemViewController.itemDescription becomeFirstResponder];
}
// for any other error do nothing
}
}

iOS - Can't trace this crash error

I'm using Crashlytics 3.6.0 and I've been getting a couple of crash reports lately that I can't read/understand. They seem to only happen on iOS 8 (can't confirm this 100% though).
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x197fcfbd0 objc_msgSend + 16
1 UIKit 0x18c035c60 -[UIControl _sendActionsForEvents:withEvent:] + 124
2 UIKit 0x18c293e7c -[UISwitch _handleLongPressNL:] + 424
3 UIKit 0x18c1af508 _UIGestureRecognizerSendActions + 276
4 UIKit 0x18c048050 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 580
5 UIKit 0x18c4b420c ___UIGestureRecognizerUpdate_block_invoke662 + 60
6 UIKit 0x18c00c530 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 292
7 UIKit 0x18c00a8dc _UIGestureRecognizerUpdate + 2504
8 UIKit 0x18c0461f8 -[UIWindow _sendGesturesForEvent:] + 1044
9 UIKit 0x18c045898 -[UIWindow sendEvent:] + 660
10 UIKit 0x18c018fa8 -[UIApplication sendEvent:] + 264
11 infinight 0x1003ebe00 -[IBGMethodSwizzler sendEvent:] (IBGMethodSwizzler.m:103)
12 UIKit 0x18c2b7f58 _UIApplicationHandleEventFromQueueEvent + 14992
13 UIKit 0x18c017510 _UIApplicationHandleEventQueue + 1616
14 CoreFoundation 0x18781e9ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x18781dc90 __CFRunLoopDoSources0 + 264
16 CoreFoundation 0x18781bd40 __CFRunLoopRun + 712
17 CoreFoundation 0x1877490a4 CFRunLoopRunSpecific + 396
18 GraphicsServices 0x1908eb5a4 GSEventRunModal + 168
19 UIKit 0x18c07e3c0 UIApplicationMain + 1488
20 infinight 0x10013af44 main (main.m:16)
21 libdyld.dylib 0x19862aa08 start + 4
Could anyone help me identify the error? I can't reproduce the error -- it doesn't happen on my device or on the simulator. But I've been getting a fair amount of crash reports like these in the last couple of days from test users.
This was an error that only occured on iOS 8. To reproduce the error, I downloaded the iOS 8.1 simulator and found the error. To get the exact error message, I went to Edit Scheme and Enabled Zombie Objects. That showed me the exact error message:
*** -[NamedUISwitch _sendActionsForEvents:withEvent:]: message sent to deallocated instance

UIApplication crash when open the app after few days

Could you help me with this mysterious crash? It happens when I re-open the app after a few days, so it's practically impossible to debug it :/
Any clue or idea would be super helpful. I'm kinda lost here. Thank you!
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x0000000196a63bd0 objc_msgSend + 16
1 UIKit 0x000000018ab35418 -[UIApplication sendAction:to:from:forEvent:] + 96
2 UIKit 0x000000018ab1e52c -[UIControl _sendActionsForEvents:withEvent:] + 612
3 UIKit 0x000000018ab34db4 -[UIControl touchesEnded:withEvent:] + 592
4 UIKit 0x000000018ab34a40 -[UIWindow _sendTouchesForEvent:] + 700
5 UIKit 0x000000018ab2df94 -[UIWindow sendEvent:] + 684
6 UIKit 0x000000018ab0168c -[UIApplication sendEvent:] + 264
7 UIKit 0x000000018ada060c _UIApplicationHandleEventFromQueueEvent + 14992
8 UIKit 0x000000018aaffbf4 _UIApplicationHandleEventQueue + 1616
9 CoreFoundation 0x000000018630a9ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
10 CoreFoundation 0x0000000186309c90 __CFRunLoopDoSources0 + 264
11 CoreFoundation 0x0000000186307d40 __CFRunLoopRun + 712
12 CoreFoundation 0x00000001862350a4 CFRunLoopRunSpecific + 396
13 GraphicsServices 0x000000018f3d75a4 GSEventRunModal + 168
14 UIKit 0x000000018ab66aa4 UIApplicationMain + 1488
15 Wiretap 0x000000010012b604 main (main.m:16)
16 libdyld.dylib 0x00000001970bea08 start + 4

UIApplication sendAction:to:from:forEvent: iOS7 no user code

I have a crash that is occurring on iOS7 only. The app is compiled against 6.1 sdk. I can not reproduce this myself but I can see from crash reports that it is occurring for some users. The problem is there is no user code in the stack trace so it is proving difficult to track down:
Exception Type: EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0x13
0 libobjc.A.dylib objc_msgSend + 5
1 UIKit -[UIApplication sendAction:to:from:forEvent:] + 90
2 UIKit -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
3 UIKit -[UIControl sendAction:to:forEvent:] + 44
4 UIKit -[UIControl _sendActionsForEvents:withEvent:] + 374
5 UIKit -[UIControl touchesEnded:withEvent:] + 590
6 UIKit -[UIWindow _sendTouchesForEvent:] + 528
7 UIKit -[UIWindow sendEvent:] + 832
8 UIKit -[UIApplication sendEvent:] + 196
9 UIKit _UIApplicationHandleEventQueue + 7096
10 ... CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
16 UIKit UIApplicationMain + 1136
I have tried enabling zombies and performing various actions in the app but that didn't flag anything.
Update
I think this might have morphed in to [UIPickerView _updateSelectedRows], EXC_BAD_ACCESS under iOS 7.1 . I will investigate further.
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x39576626 objc_msgSend + 5
1 UIKit 0x3187b12f -[UIPickerView _updateSelectedRows] + 54
2 UIKit 0x3187b26f -[UIPickerView didMoveToWindow] + 78
3 UIKit 0x3160ad37 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1358
4 UIKit 0x3160aaa5 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
5 UIKit 0x3160a40d __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 112
6 UIKit 0x3160a263 -[UIView(Hierarchy) _postMovedFromSuperview:] + 250
7 UIKit 0x318a2a27 __UIViewWasRemovedFromSuperview + 218
8 UIKit 0x31609187 -[UIView(Hierarchy) removeFromSuperview] + 270
9 UIKit 0x316cf26f -[UIPeripheralHost(UIKitInternal) adjustHostViewForTransitionCompletion:] + 310
10 UIKit 0x31a6ca8b __53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke1364 + 318
11 UIKit 0x3164378d -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 284
12 UIKit 0x316433d7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 178
13 UIKit 0x316432ef -[UIViewAnimationState animationDidStop:finished:] + 66
14 QuartzCore 0x3128de0b CA::Layer::run_animation_callbacks(void*) + 234
15 libdispatch.dylib 0x39a55d3f _dispatch_client_callout + 22
16 libdispatch.dylib 0x39a586c3 _dispatch_main_queue_callback_4CF + 278
17 CoreFoundation 0x2eda6679 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
18 CoreFoundation 0x2eda4f45 __CFRunLoopRun + 1308
19 CoreFoundation 0x2ed0f7a9 CFRunLoopRunSpecific + 524
20 CoreFoundation 0x2ed0f58b CFRunLoopRunInMode + 106
21 GraphicsServices 0x33c6c6d3 GSEventRunModal + 138
22 UIKit 0x3166e891 UIApplicationMain + 1136
I had the almost identical crash log with our project we were able to track to an animation.
The problem was that we animated a UIPickerView on and off the screen. If the ViewController that owned the UIPickerView was popped and dealloced during the animation. We solved this by removing the UIPickerView from the superview in the animation completion block.
[UIView animateWithDuration:0.5f animations:^{
//Set the destination frame of the PickerView
} completion:^(BOOL finished) {
[self.pickerView removeFromSuperview];
}];
I don't know about other crash reporting tools, but Crashlytics includes the CLS_LOG() macro:
http://support.crashlytics.com/knowledgebase/articles/92519-how-do-i-use-logging
During development, it behaves as NSLog() but in the field, the log statements are included in crash reports. So I suggest replacing your debugging statements with CLS_LOG or start peppering the code in question with lots of statements that capture the user actions, then deploy a new version of your app.
(Old question, but I recently ran into something similar and would like to document this.)
All I just received a similar crash with a UIPicker. Turns out that I forgot to set the delegate to nil before deallocating it. The problem only presented when running with breakpoints enabled. Hope this helps someone else.
Try removing arm64 from:
Project > BuildSettings > Architectures> Valid Architectures
and rebuilding you app.
You might also need to set Build Active Architectures Only to NO for it to work.

Random crash with UIAlertView

I am getting random crashes with an UIAlertView. The crash does not always happen, and it is very random. Any help is appreciated.
Here is the stack trace :
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x398685b0 objc_msgSend + 16
1 UIKit 0x33b59c4c -[UIAlertView(Private) _buttonClicked:]
2 UIKit 0x33aed0c0 -[UIApplication sendAction:to:from:forEvent:]
3 UIKit 0x33aed072 -[UIApplication sendAction:toTarget:fromSender:forEvent:]
4 UIKit 0x33aed050 -[UIControl sendAction:to:forEvent:]
5 UIKit 0x33aec906 -[UIControl(Internal) _sendActionsForEvents:withEvent:]
6 UIKit 0x33aecdfc -[UIControl touchesEnded:withEvent:]
7 UIKit 0x33a155ec -[UIWindow _sendTouchesForEvent:]
8 UIKit 0x33a027fc -[UIApplication sendEvent:]
9 UIKit 0x33a02116 _UIApplicationHandleEvent
10 GraphicsServices 0x356f25a0 _PurpleEventCallback
11 GraphicsServices 0x356f21ce PurpleEventCallback
12 CoreFoundation 0x31bcf170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
13 CoreFoundation 0x31bcf112 __CFRunLoopDoSource1
14 CoreFoundation 0x31bcdf94 __CFRunLoopRun
15 CoreFoundation 0x31b40eb8 CFRunLoopRunSpecific
16 CoreFoundation 0x31b40d44 CFRunLoopRunInMode
17 GraphicsServices 0x356f12e6 GSEventRunModal
18 UIKit 0x33a562fc UIApplicationMain
Your delegate is probably being cleaned up before the button press. This can happen (for example) if the view or that launched the alert is no longer on screen. Try turning on Zombie Objects (under Edit Scheme -> Run -> Diagnostics). If a deallocated object is sent a message, you'll get a message in the debug console.

Resources