Reporting crash on UITableview reloadData - ios

I'm getting a crash report from Crashlytics that is always in the same place but I'm unable to replicate the crash.
It seems to be only users on iOS 9 and only very occasionally. I'm not sure if it's a code issue or something else. The last line mentions libdispatch.dylib as being missing, again, not sure if relevant.
Crashlytics indicates that the crash occurs at MMDetailTableVC.m line 1407, which is the reloadData line.
Here's what is reported:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000001
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x20f0fae2 objc_msgSend + 1
1 CoreFoundation 0x2168b91b -[NSDictionary descriptionWithLocale:indent:] + 310
2 Foundation 0x21e77e2d _NSDescriptionWithLocaleFunc + 60
3 CoreFoundation 0x217091a3 __CFStringAppendFormatCore + 7986
4 CoreFoundation 0x21707255 _CFStringCreateWithFormatAndArgumentsAux2 + 80
5 CoreFoundation 0x2171f559 _CFLogvEx2 + 96
6 CoreFoundation 0x2171f9af _CFLogvEx3 + 118
7 Foundation 0x21f3f4f7 _NSLogv + 126
8 Foundation 0x21e8679d NSLog + 28
9 UIKit 0x259b45fb -[UITableView reloadData] + 1818
10 Simple Meeting Minutes 0x91fff -[MMDetailTableVC saveItemEntry:] (MMDetailTableVC.m:1407)
11 Simple Meeting Minutes 0xa2edf -[MMItemViewController saveButtonAction:] (MMItemViewController.m:526)
12 UIKit 0x25905771 -[UIApplication sendAction:to:from:forEvent:] + 80
13 UIKit 0x25a86c71 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 140
14 UIKit 0x25905771 -[UIApplication sendAction:to:from:forEvent:] + 80
15 UIKit 0x25905701 -[UIControl sendAction:to:forEvent:] + 64
16 UIKit 0x258ed61f -[UIControl _sendActionsForEvents:withEvent:] + 446
17 UIKit 0x258ed74b -[UIControl _sendActionsForEvents:withEvent:] + 746
18 UIKit 0x25905051 -[UIControl touchesEnded:withEvent:] + 616
19 UIKit 0x25904cbf -[UIWindow _sendTouchesForEvent:] + 646
20 UIKit 0x258fd5d7 -[UIWindow sendEvent:] + 642
21 UIKit 0x258ce119 -[UIApplication sendEvent:] + 204
22 UIKit 0x258cc757 _UIApplicationHandleEventQueue + 5134
23 CoreFoundation 0x216f9257 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
24 CoreFoundation 0x216f8e47 __CFRunLoopDoSources0 + 454
25 CoreFoundation 0x216f71af __CFRunLoopRun + 806
26 CoreFoundation 0x21649bb9 CFRunLoopRunSpecific + 516
27 CoreFoundation 0x216499ad CFRunLoopRunInMode + 108
28 GraphicsServices 0x228c3af9 GSEventRunModal + 160
29 UIKit 0x25935fb5 UIApplicationMain + 144
30 Simple Meeting Minutes 0x8c59f main (main.m:16)
31 libdispatch.dylib 0x212fc873 (Missing)
And here's my code for saveItemEntry that always seems to be the place where the crash occurs.
- (void)saveItemEntry:(MMitem *)item{
if (item)
{
NSString *resultStr = [self.meetingModel saveItem:item];
if ([resultStr isEqualToString:#"OK"])
{
// all good so close form and refresh data
[_itemViewController 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
}
}

We don't know if you are calling this method in main thread or not.
And also tableview is taking time in reloading it's cell. So it would be great, if you can add these codes in dispatch_get_main_queue
dispatch_async(dispatch_get_main_queue(), ^(void){
[_itemViewController dismissViewControllerAnimated:NO completion:nil];
[self.tableView reloadData];
}
and
dispatch_async(dispatch_get_main_queue(), ^(void){
[self showAlert:#"Missing Description or Notes" :#"An Item Description or Notes is required" :0];
[self.itemViewController.itemDescription becomeFirstResponder];
}
It will be much safe, if we are working on refreshing the UI from any notification or delegation with dispatch_async(dispatch_get_main_queue(), ^(void){

Hooray - finally found the reason for this elusive problem. The crash was being due to the user being in edit mode within a UITextfield within a cell in the table when the reloadData was being called (as a result of the user tapping elsewhere or rotating the iPad, which also called ReloadData).
I fixed the issue by preceeding any [self.tableView ReloadData] with [self.view endEditing:YES] to ensure that the keyboard was dismissed and cells were not in an edit mode.
Does make sense but what a nasty trap.

Related

iOS app crashing, Unable to find scenario

When running my app, it crashes and I don't see something wrong with my code. Please help me to find this issue.
Here is the code in method didSelectRow in UITableViewDelegate, where it crashes:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[[SingletonClass SharedMethod] setGlobalAddSubjectResueIdentifier:#"ForListDetails"];
[self.tblSearchHolder deselectRowAtIndexPath:[self.tblSearchHolder indexPathForSelectedRow] animated:YES];
NSDictionary *dictGGetSelectedVal=[arrLoadDataTemp objectAtIndex:indexPath.row];
[[SingletonClass SharedMethod] setGlobalSelectedSearchProperty:dictGGetSelectedVal];
arrGetValForTable=nil;
arrLoadDataTemp=nil;
[[SingletonClass SharedMethod] setGlobalHolder:#"addPropertyScene"];
[[NSNotificationCenter defaultCenter] postNotificationName:#"ChangeViewsAsPerCriteria" object:nil];
}
And the crash report itself:
NSInvalidArgumentException: Cannot create task from nil request
18 UIKit 0x18d7f8b20 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] (in UIKit) + 1352
19 UIKit 0x18d8a1760 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] (in UIKit) + 268
20 UIKit 0x18d94faa8 _runAfterCACommitDeferredBlocks (in UIKit) + 292
21 UIKit 0x18d942e5c _cleanUpAfterCAFlushAndRunDeferredBlocks (in UIKit) + 288
22 UIKit 0x18d6d4464 _afterCACommitHandler (in UIKit) + 132
23 CoreFoundation 0x1840cecdc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ (in CoreFoundation) + 32
24 CoreFoundation 0x1840cc694 __CFRunLoopDoObservers (in CoreFoundation) + 412
25 CoreFoundation 0x1840ccc50 __CFRunLoopRun (in CoreFoundation) + 1292
26 CoreFoundation 0x183fecc58 CFRunLoopRunSpecific (in CoreFoundation) + 436
27 GraphicsServices 0x185e98f84 GSEventRunModal (in GraphicsServices) + 100
28 UIKit 0x18d7455c4 UIApplicationMain (in UIKit) + 236
29 EnrichedValues 0x100dd6cc8 0x100d80000 + 355528
30 libdyld.dylib 0x183b0c56c start (in libdyld.dylib) + 4
Ok, it can be found quite easily (with a bit of luck :)).
First of all, try to enable NSZombie objects as follows:
Try to put an exception breakpoint as follows (make sure you're on the breakpoint's tab):
Good luck & happy coding! :)

Objective-C iOS app crashes during CFStringAppend for unknown reason

In my iPhone app, for some users the app will always crash, whenever they open a certain window. The same window works fine for me and other people, but always causes a crash for some people. It is unclear at this moment what the difference is between people for whom it fails, and for whom it works fine.
The animation to open the specific view will run fine, but will then cause a crash immediately after the animation is finished.
They have sent me the crashlog, but it is hard to understand what is exactly going wrong. I am hoping you can help me understand. The cause for the failure as given by the crashlog is the following exception:
Last Exception Backtrace:
0 CoreFoundation 0x1836ffd38 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x182c14528 objc_exception_throw + 55
2 CoreFoundation 0x18370d1f8 -[NSObject+ 1372664 (NSObject) doesNotRecognizeSelector:] + 139
3 UIKit 0x18cec7cc4 -[UIResponder doesNotRecognizeSelector:] + 295
4 CoreFoundation 0x1837056e4 ___forwarding___ + 1379
5 CoreFoundation 0x1835eb0dc _CF_forwarding_prep_0 + 91
6 CoreFoundation 0x1835d6be8 CFStringAppend + 519
7 CoreFoundation 0x1836bddf0 __CFStringAppendFormatCore + 9271
8 CoreFoundation 0x1836bf658 _CFStringCreateWithFormatAndArgumentsAux2 + 131
9 AccessibilityUtilities 0x192d6b388 _AXStringForArgs + 279
10 UIKit 0x1a242adf8 -[UIViewControllerAccessibility viewDidAppear:] + 267
11 UIKit 0x18cb2869c -[UIViewController _setViewAppearState:isAnimating:] + 851
12 UIKit 0x18cb28c08 -[UIViewController _endAppearanceTransition:] + 227
13 UIKit 0x18cbcee00 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 1327
14 UIKit 0x1a2440cd4 -[UINavigationControllerAccessibility navigationTransitionView:didEndTransition:fromView:toView:] + 111
15 UIKit 0x18cc96bbc __49-[UINavigationController _startCustomTransition:]_block_invoke + 251
16 UIKit 0x18cc229d8 -[_UIViewControllerTransitionContext completeTransition:] + 115
17 UIKit 0x18cd67d30 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke.124 + 751
18 UIKit 0x18cb47d7c -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 763
19 UIKit 0x18cb4770c -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 311
20 UIKit 0x18cb47418 -[UIViewAnimationState animationDidStop:finished:] + 295
21 UIKit 0x1a2468970 -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 131
22 QuartzCore 0x1876ebd6c CA::Layer::run_animation_callbacks+ 1232236 (void*) + 283
23 libdispatch.dylib 0x183085048 _dispatch_client_callout + 15
24 libdispatch.dylib 0x183091b74 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1015
25 CoreFoundation 0x1836a7f20 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 11
26 CoreFoundation 0x1836a5afc __CFRunLoopRun + 2011
27 CoreFoundation 0x1835c62d8 CFRunLoopRunSpecific + 435
28 GraphicsServices 0x185457f84 GSEventRunModal + 99
29 UIKit 0x18cb73880 UIApplicationMain + 207
30 Flyskyhy 0x10490bd80 main + 32128 (main.m:17)
31 libdyld.dylib 0x1830ea56c start + 3
The crashlog seems to indicate that it goes wrong while doing a CFStringAppend, but it is not clear which string is the problem, or what is wrong with it, or even why a CFStringAppend is needed. All strings visible in the view have been filled in already before the animation starts, and they all are correct.
EDIT:
As requested, here is the code that starts the view. Everything is under a NavigationController, so the new view controller is pushed on the navigation stack to open it.
WaypointEditController *controller = [[WaypointEditController alloc] initWithNibName:#"WayPointEdit" bundle:nil];
controller.navigationItem.title = #"New Waypoint";
// initialisation of other, custom, fields of controller
[self.navigationController pushViewController:controller animated:YES];
The WaypointEditController class that is pushed is derived from UIViewController. The viewWillAppear is overridden, to do initialisation of the fields of the view. But - relevant here - viewDidAppear is not overridden.
In case relevant, here are the most important actions in the viewWillAppear method:
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
self.navigationItem.title = #"New Waypoint";
// other initialisation of internal fields
}
Like you, I have customers reporting this problem and I could see the stack traces that XCode downloaded from production but I could not reproduce it... until I tried enabling "voice over".
The other accessibility options that I tried worked OK.
The stack trace shows that iOS is sending a selector of "length" to an instance of UILabel. This seemed odd. To see what would happen, I added a "length" method to UILabel to return the length of the UILabel's text property. Then it just failed with an unknown selector of _encodingCantBeStoredInEightBitCFString. So clearly iOS thought that my UILabel was something that it wasn't.
This ended up being because "description" was used for the name of my UILabel property/IBOutlet.
To fix the problem I renamed the property from "description" to something different. I suspect that my synthesized "description" getter was overriding NSObject's description method (which returns an NSString which fits the selectors which were being sent to my UILabel).

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
}
}

Random UISearchDisplayController Crash (iOS 7)

I've been trying to fix a crash that around 50% of my users are having. The crash began after I implemented a UISearchDisplayController (ie. added a search bar to a table view), but I haven't been able to reproduce the crash, not even once. According to my users, they instantly crash (or freeze) when they open the table view that has the UISearchDisplayController.
According to Crashlytics, the crash is happening at:
-[UISearchDisplayController _updateTableHeaderBackgroundViewInTableView:amountScrolledUnder:]
I've created the UITableView programmatically, but I've added the UISearchBar/UISearchDisplayController mostly via IB.
Regarding the "table header background view" that the crash seems to be referring to, I was doing two things previously. Firstly, I was setting the table views background view to nil:
[self.tableView setBackgroundView:nil];
Secondly, I was also doing this:
- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section
{
if (aTableView != nil && self.searchDisplayController != nil)
{
if (self.searchDisplayController.isActive)
{
return nil;
}
else
{
return [super sectionAtIndex:section].headerTitle;
}
}
else
{
return [super sectionAtIndex:section].headerTitle;
}
}
I've since then change the background view to a __strong UIView with a frame size of CGZero, meaning I've just added a strong, empty view to the background.
Additionally, in the second piece of code, instead of returning nil, I'm now returning an empty string, #"".
I haven't pushed these changes to my users yet, because I want to be sure before I do so. Tried to google the UISearchDisplayController function but didn't really find anything, so I'm guessing it's an iOS 7-specific issue, which makes it even harder to track down, especially since I can't reproduce it.
Anyway, I'm hoping that someone has either experienced this kind of problem themselves, or that someone has some sort of idea on what could be causing this.
UPDATE: Here's the full crash.
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x0000000191f179d0 objc_msgSend + 16
1 UIKit 0x0000000188f63820 -[UISearchDisplayController _updateTableHeaderBackgroundViewInTableView:amountScrolledUnder:] + 164
2 UIKit 0x0000000188f63394 -[UISearchBar _didMoveFromWindow:toWindow:] + 312
3 UIKit 0x0000000188e6e42c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 684
4 UIKit 0x0000000188e9280c -[UIScrollView _didMoveFromWindow:toWindow:] + 68
5 UIKit 0x0000000188e6dba0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 148
6 UIKit 0x0000000188e6d998 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
7 UIKit 0x0000000188e7c4ec -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1628
8 UIKit 0x000000018906af44 -[_UIParallaxDimmingView didMoveToWindow] + 144
9 UIKit 0x0000000188e6e768 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1512
10 UIKit 0x0000000188e6e42c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 684
11 UIKit 0x0000000188e6dba0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 148
12 UIKit 0x0000000188e6d998 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
13 UIKit 0x0000000188e7c4ec -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1628
14 UIKit 0x000000018906a67c __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1636
15 UIKit 0x0000000188e82bb8 +[UIView(Animation) performWithoutAnimation:] + 88
16 UIKit 0x0000000189069d54 -[_UINavigationParallaxTransition animateTransition:] + 828
17 UIKit 0x0000000189022078 -[UINavigationController _startCustomTransition:] + 2724
18 UIKit 0x0000000188f2c794 -[UINavigationController _startDeferredTransitionIfNeeded:] + 464
19 UIKit 0x0000000188f2c564 -[UINavigationController __viewWillLayoutSubviews] + 56
20 UIKit 0x0000000188f2c4e4 -[UILayoutContainerView layoutSubviews] + 200
21 UIKit 0x0000000188e6ed78 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 348
22 QuartzCore 0x0000000188a6b0cc -[CALayer layoutSublayers] + 184
23 QuartzCore 0x0000000188a65c94 CA::Layer::layout_if_needed(CA::Transaction*) + 300
24 QuartzCore 0x0000000188a65b4c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
25 QuartzCore 0x0000000188a653d4 CA::Context::commit_transaction(CA::Transaction*) + 280
26 QuartzCore 0x0000000188a65178 CA::Transaction::commit() + 424
27 QuartzCore 0x0000000188a5ea30 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
28 CoreFoundation 0x0000000185f5f7e0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
29 CoreFoundation 0x0000000185f5ca68 __CFRunLoopDoObservers + 372
30 CoreFoundation 0x0000000185f5cdf4 __CFRunLoopRun + 764
31 CoreFoundation 0x0000000185e9db38 CFRunLoopRunSpecific + 452
32 GraphicsServices 0x000000018b8c3830 GSEventRunModal + 168
33 UIKit 0x0000000188edc0e8 UIApplicationMain + 1156
34 Flash Reader 0x00000001000904dc main + 17 (main.m:17)
35 libdyld.dylib 0x0000000192507aa0 start + 4
UPDATE 2:
It seems like this is only happening on an iPhone 5S and that would also explain why I'm unable to reproduce this. I have a feeling that it's related to this block of code:
CGRect newBounds = self.tableView.bounds;
if (self.tableView.bounds.origin.y < 44)
{
newBounds.origin.y = newBounds.origin.y + self.searchDisplayController.searchBar.bounds.size.height;
self.tableView.bounds = newBounds;
}
// new for iOS 7
if (self.tableView != nil && self.staticContentSections.count > 0)
{
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:0 animated:YES];
}
I'm hoping that this is what causes the crash, because if so, I'm hoping to fix this by just doing this in viewWillAppear:
self.edgesForExtendedLayout = UIRectEdgeNone;
self.tableView.contentOffset = CGPointMake(0, 44);
UPDATE 3:
Well, that didn't fix it. This is still happening, either randomly or each time when the user has an iPhone 5S. It doesn't happen in the 5S simulator, but I can't debug it any further since I don't own a 5S. I'm starting to think that this is an iOS 7 bug, not a bug with the app itself.
I got the crash in iOS 8.0. I fixed it by setting searchBar.delegate = nil in dealloc (deinit) of the view controller.

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.

Resources