EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000002 on UITableView reloadData - ios

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

Related

Reporting crash on UITableview reloadData

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.

Exception when saving nested NSManagedObjectContext - "Can't perform collection evaluate with non-collection object."

I'm seeing some of my users suffering this crash, though it's not reproducible, so I don't understand what it could mean. The stack trace is as follows:
Exception Type: SIGABRT
Exception Codes: #0 at 0x19968f1e0
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't perform collection evaluate with non-collection object.'
Last Exception Backtrace:
0 CoreFoundation 0x0000000184154f5c __exceptionPreprocess + 124
1 libobjc.A.dylib 0x0000000198d47f80 objc_exception_throw + 52
2 Foundation 0x00000001850e92c8 -[NSSubqueryExpression expressionValueWithObject:context:] + 768
3 Foundation 0x0000000184fee964 -[NSFunctionExpression expressionValueWithObject:context:] + 188
4 Foundation 0x0000000184fee7d0 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 228
5 Foundation 0x00000001850e91a4 -[NSSubqueryExpression expressionValueWithObject:context:] + 476
6 Foundation 0x0000000184fee964 -[NSFunctionExpression expressionValueWithObject:context:] + 188
7 Foundation 0x0000000184fee7d0 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 228
8 Foundation 0x0000000184fee610 -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 388
9 Foundation 0x0000000184fee2b4 -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 276
10 Foundation 0x0000000184fee55c -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 208
11 Foundation 0x0000000184fee2b4 -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 276
12 CoreData 0x0000000183e2d30c -[NSFetchedResultsController(PrivateMethods) _objectInResults:] + 104
13 CoreData 0x0000000183e2c868 -[NSFetchedResultsController(PrivateMethods) _preprocessUpdatedObjects:insertsInfo:deletesInfo:updatesInfo:sectionsWithDeletes:newSectionNames:treatAsRefreshes:] + 552
14 CoreData 0x0000000183f25498 __77-[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:]_block_invoke + 1552
15 CoreData 0x0000000183e9bc20 developerSubmittedBlockToNSManagedObjectContextPerform + 192
16 CoreData 0x0000000183e9bae8 -[NSManagedObjectContext performBlockAndWait:] + 216
17 CoreData 0x0000000183e2bfe0 -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 112
18 CoreFoundation 0x00000001840fa6ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16
19 CoreFoundation 0x00000001840f9ecc _CFXRegistrationPost + 392
20 CoreFoundation 0x00000001840f9c4c ___CFXNotificationPost_block_invoke + 56
21 CoreFoundation 0x000000018415f434 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1528
22 CoreFoundation 0x000000018403a834 _CFXNotificationPost + 364
23 Foundation 0x0000000184fa62fc -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
24 CoreData 0x0000000183e2bf44 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 76
25 CoreData 0x0000000183e2bed0 -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 324
26 CoreData 0x0000000183e2a5c0 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2320
27 CoreData 0x0000000183ea4790 -[NSManagedObjectContext(_NestedContextSupport) _parentProcessSaveRequest:inContext:error:] + 1420
28 CoreData 0x0000000183ea50b8 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 344
29 CoreData 0x0000000183e972ec _perform + 320
30 CoreData 0x0000000183ea4e98 -[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:] + 172
31 CoreData 0x0000000183e29514 -[NSManagedObjectContext save:] + 1160
32 CJournal 0x000000010019eee4 __41-[AddEditLogsWithStoryboard savePressed:]_block_invoke (AddEditLogsWithStoryboard.m:461)
33 CoreData 0x0000000183e9bc20 developerSubmittedBlockToNSManagedObjectContextPerform + 192
34 libdispatch.dylib 0x0000000199541770 _dispatch_client_callout + 12
35 libdispatch.dylib 0x000000019954c9c4 _dispatch_barrier_sync_f_invoke + 96
36 CoreData 0x0000000183e9bb08 -[NSManagedObjectContext performBlockAndWait:] + 248
37 CJournal 0x000000010019ee3c -[AddEditLogsWithStoryboard savePressed:] (AddEditLogsWithStoryboard.m:456)
38 UIKit 0x00000001896e23e4 -[UIApplication sendAction:to:from:forEvent:] + 96
39 UIKit 0x00000001898613f8 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 164
40 UIKit 0x00000001896e23e4 -[UIApplication sendAction:to:from:forEvent:] + 96
41 UIKit 0x00000001896e2360 -[UIControl sendAction:to:forEvent:] + 76
42 UIKit 0x00000001896cac88 -[UIControl _sendActionsForEvents:withEvent:] + 412
43 UIKit 0x00000001896cadd4 -[UIControl _sendActionsForEvents:withEvent:] + 744
44 UIKit 0x00000001896e1c78 -[UIControl touchesEnded:withEvent:] + 568
45 UIKit 0x00000001896e18a8 -[UIWindow _sendTouchesForEvent:] + 800
46 UIKit 0x00000001896daadc -[UIWindow sendEvent:] + 780
47 UIKit 0x00000001896aba2c -[UIApplication sendEvent:] + 244
48 UIKit 0x00000001896a9f18 _UIApplicationHandleEventQueue + 5344
49 CoreFoundation 0x000000018410c5a4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20
50 CoreFoundation 0x000000018410c038 __CFRunLoopDoSources0 + 536
51 CoreFoundation 0x0000000184109d38 __CFRunLoopRun + 720
52 CoreFoundation 0x0000000184038dc0 CFRunLoopRunSpecific + 380
53 GraphicsServices 0x000000018f18c088 GSEventRunModal + 176
54 UIKit 0x0000000189712f60 UIApplicationMain + 200
55 CJournal 0x00000001000a73c4 main (main.m:17)
56 libdyld.dylib 0x00000001995728b8 start + 0
The code for when the "save" button is pressed is as follows:
[self.privateContext performBlockAndWait: ^{
NSError *error = nil;
self.existingLog.logSectionPeriod = nil;
if ([self.privateContext save:&error]){
[self.privateContext.parentContext performBlockAndWait:^{
NSError *parentError = nil;
if ([self.privateContext.parentContext save: &parentError]){
if (_delegate && [_delegate respondsToSelector:#selector(finishedCommonAddEditViewController:)])
[_delegate finishedCommonAddEditViewController:self];
else {
[self dismissViewControllerAnimated:YES completion:nil];
}
} else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}];
} else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}];
I can't really find any details about the exception message "Can't perform collection evaluate with non-collection object.". Anyone have any idea what this could be referring to?
Incidentally, the NSFetchedResultsController the stack is referring to is tied to a UITableView (not collection view). It doesn't set any predicates on it, so it's not like the predicate could be causing some issue.
Would love some opinions on what this could mean by analyzing the stack trace
==== Some more details ====
A Person has one-to-many relationship with Notes. A Note has one-to-one with Person. There are different NSFetchedResultsControllers that are listening to changes that can be affected, but it's not clear from the stack trace which one has the problem:
one with Notes entity with a 'person == self.notesPerson" predicate
(to show notes for this person only)
one with Notes entity without
a predicate, to show all the notes in one list.
one with Person entity without a predicate, but with 'notes' as part of the
"relationshipKeyPathsForPrefetching" array
The AddEditLogsWithStoryboard.m lines from the stack are the first and 7th line in the code snippet (performBlockAndWait) so they don't particularly help. What would have been useful is to know which collection property it is complaining about, or which of the NSFetchedResultsControllers

crash with insertObject:atIndex: object cannot be nil but no array

I'm fighting with a crash in my app but I can't find where it happens.
I'm working with last version of MZFormSheetController. When I receive a remote push I present a basic MZFormSheetController, it was working nice but from one day to the other it starts crashing with a weird stack trace :
Fatal Exception: NSInvalidArgumentException
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x2bfc2fef __exceptionPreprocess + 126
1 libobjc.A.dylib 0x3a274c8b objc_exception_throw + 38
2 CoreFoundation 0x2bedcefb -[__NSArrayM insertObject:atIndex:] + 638
3 UIKit 0x2fb6289f __workaround10030904InvokeWithTarget_block_invoke + 14
4 UIKit 0x2f8b2ab1 +[UIView _performSystemAppearanceModifications:] + 32
5 UIKit 0x2f780639 workaround10030904InvokeWithTarget + 704
6 UIKit 0x2fb5ff3b applyInvocationsToTarget + 1242
7 UIKit 0x2f6bdd8f +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 1262
8 UIKit 0x2f6bd89b +[_UIAppearance _applyInvocationsTo:window:] + 30
9 UIKit 0x2f8bc353 __88-[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]_block_invoke + 54
10 UIKit 0x2f8bc2cb -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 262
11 UIKit 0x2f61cf07 -[UIView(Internal) _didChangeFromIdiom:onScreen:traverseHierarchy:] + 30
12 UIKit 0x2f633f0f -[UIScrollView _didChangeFromIdiom:onScreen:traverseHierarchy:] + 46
13 UIKit 0x2f8bc1b7 -[UIView(Internal) _didChangeFromIdiomOnScreen:traverseHierarchy:] + 138
14 UIKit 0x2f61497d -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1316
15 UIKit 0x2f633dfb -[UIScrollView _didMoveFromWindow:toWindow:] + 50
16 UIKit 0x2f6146fb -[UIView(Internal) _didMoveFromWindow:toWindow:] + 674
17 UIKit 0x2f6146fb -[UIView(Internal) _didMoveFromWindow:toWindow:] + 674
18 UIKit 0x2f613fa7 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 114
19 UIKit 0x2f613ec1 -[UIView(Hierarchy) _postMovedFromSuperview:] + 428
20 UIKit 0x2f61e72b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1498
21 UIKit 0x2f61e14b -[UIView(Hierarchy) addSubview:] + 30
22 UIKit 0x2f61db69 -[UIWindow addRootViewControllerViewIfPossible] + 432
23 UIKit 0x2f61b3a1 -[UIWindow _setHidden:forced:] + 272
24 UIKit 0x2f6864a1 -[UIWindow makeKeyAndVisible] + 48
25 Project 0x000f382d -[MZFormSheetController presentAnimated:completionHandler:] (MZFormSheetController.m:509)
26 Project 0x0021b879 __60+[ARDPopupManager showFormsheet:animated:completionHandler:]_block_invoke_2 (ARDPopupManager.m:46)
27 libdispatch.dylib 0x3a7e9ecd _dispatch_barrier_sync_f_slow_invoke + 372
28 libdispatch.dylib 0x3a7df2cf _dispatch_client_callout + 22
29 libdispatch.dylib 0x3a7e2d2f _dispatch_main_queue_callback_4CF + 1330
30 CoreFoundation 0x2bf88609 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
31 CoreFoundation 0x2bf86d09 __CFRunLoopRun + 1512
32 CoreFoundation 0x2bed3201 CFRunLoopRunSpecific + 476
33 CoreFoundation 0x2bed3013 CFRunLoopRunInMode + 106
34 GraphicsServices 0x337b2201 GSEventRunModal + 136
35 UIKit 0x2f677a59 UIApplicationMain + 1440
36 Project 0x0007a88d main (main.m:14)
37 libdyld.dylib 0x3a800aaf start + 2
Of course I understand the crash but the exception breakpoint stops at this line :
[self.formSheetWindow makeKeyAndVisible];
In MZFormSheetController library and the MZFormSheetController is presented from my code like :
[formsheet presentAnimated:animated completionHandler:nil];
I added an All Exception Breakpoint but it does not point to an addObject: or insertObject:atIndex: method. Maybe it is elsewhere but I can't figure it out. I can't find the NSArray causing this crash.
Finally found : in the view controller presented in form sheet controller I added an UITextView and in my AppDelegate I wrote [[UITextView appearance] setKeyboardAppearance:UIKeyboardAppearanceDark]; and it crashes when I present the UITextView. So I had to set keyboard appearance individually on each UITextView instances storyboard or code...
I think it will solve problem.
YourViewController *objVc = [[YourViewController alloc] init]; // or you can use initWithNib
// Your remaining code
MZFormSheetController *formSheet = [[MZFormSheetController alloc]initWithViewController:objVc];
formSheet.transitionStyle = MZFormSheetTransitionStyleSlideFromBottom; //try different style
formSheet.presentedFormSheetSize = CGSizeMake(320, self.view.frame.size.height);
formSheet.willPresentCompletionHandler = ^(UIViewController *presentedFSViewController)
{
presentedFSViewController.view.autoresizingMask = presentedFSViewController.view.autoresizingMask | UIViewAutoresizingFlexibleWidth;
};
formSheet.shouldCenterVertically = YES;
[formSheet presentAnimated:YES completionHandler:^(UIViewController *presentedFSViewController){ }];

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

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

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