While I am testing my iOS application its getting crashed at some point. the crash log as follows can any one please suggest me what might be the reasons to crash. and how can i easily understand where crash is occurs from this crash log data
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000192f881d0 objc_msgSend + 16
1 UIKit 0x0000000189c7b2c8 -[_UIModalItemsCoordinator _notifyDelegateModalItem:tappedButtonAtIndex:] + 120
2 UIKit 0x0000000189c7b1e8 -[_UIModalItemAlertContentView tableView:didSelectRowAtIndexPath:] + 984
3 UIKit 0x0000000189b6d794 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1260
4 UIKit 0x0000000189c2e230 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 236
5 UIKit 0x0000000189ac246c _applyBlockToCFArrayCopiedToStack + 352
6 UIKit 0x0000000189a2e4a0 _afterCACommitHandler + 500
7 CoreFoundation 0x0000000186a330a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
8 CoreFoundation 0x0000000186a3032c __CFRunLoopDoObservers + 368
9 CoreFoundation 0x0000000186a306b8 __CFRunLoopRun + 760
10 CoreFoundation 0x00000001869716cc CFRunLoopRunSpecific + 448
11 GraphicsServices 0x000000018c655c08 GSEventRunModal + 164
12 UIKit 0x0000000189aa2fd8 UIApplicationMain + 1152
13 whirlpool-minerva 0x0000000100047834 0x100024000 + 145460
14 libdyld.dylib 0x000000019356ba9c start + 0
A delegate of UIAlertView is deallocated before the alert is dismissed.
If you have an object that is set to be a delegate of UIAlertView and the object may 'die' at some point of app execution (possibly when alert is on screen), then you must set alert view's delegate property to nil in -dealloc method. You have to save a reference to the created alert.
Simple example:
#property (nonatomic, strong) UIAlertView *alert;
...
self.alert = [[UIAlertView alloc] initWith... delegate:self ...];
[self.alert show];
...
- (void)dealloc {
self.alert.delegate = nil;
}
Related
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).
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
}
}
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.
I'm getting a strange crash with the iAd error callback. Here is my crash log:
Exception Type: EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0x2281
0com.apple.main-thread Crashed
0 libobjc.A.dylib objc_retain + 17
1 YouDoodle AdView.m line 265 -[AdContainerView requestGAD]
2 iAd -[ADBannerView _forwardErrorToDelegate:] + 254
3 iAd -[ADBannerView serverBannerViewDidFailToReceiveAdWithError:] + 178
4 iAd -[ADAdSpace setServiceAdSpace:] + 472
5 CoreFoundation __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation _CFXNotificationPost + 1718
7 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] + 76
8 Foundation -[NSNotificationCenter postNotificationName:object:] + 30
9 iAd -[ADAdSheetProxy _adSheetConnectionLost] + 292
10 ... libdispatch.dylib _dispatch_call_block_and_release + 10
11 libdispatch.dylib _dispatch_client_callout + 22
12 libdispatch.dylib _dispatch_main_queue_callback_4CF$VARIANT$up + 274
13 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
14 CoreFoundation __CFRunLoopRun + 1300
15 CoreFoundation CFRunLoopRunSpecific + 522
16 CoreFoundation CFRunLoopRunInMode + 106
17 GraphicsServices GSEventRunModal + 138
18 UIKit UIApplicationMain + 1136
19 YouDoodle
AppDelegate.m line 129
main
http://crashes.to/s/c654d14dcfa
delegate callback for iAd:
- (void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
DLog(#"IAD Failed to load with error %#", error);
self.adBannerContainer.hidden = YES;
if (InternetAvailableWithAlert(NO))
{
if (self.gadAvailable)
{
self.gadBannerContainer.hidden = NO;
}
else
{
[self requestGAD];
}
}
}
- (void) requestGAD
{
GADRequest* request = [[GADRequest alloc] init];
#if TARGET_IPHONE_SIMULATOR
request.testDevices = #[GAD_SIMULATOR_ID];
#endif
self.gadBanner.rootViewController = (self.gadBanner.rootViewController ?: self.viewController);
[self.gadBanner loadRequest:request];
}
The iAd view delegate is a singleton which is never released. Even if it was released, the iAd class delegate property is a weak property so it should auto-nil.
#property (nonatomic, weak) id<ADBannerViewDelegate> delegate;
Ideas?
This was due to setting the Admob SDK root view controller back to itself, when the view controller has been deallocated, this crashes. Admob SDK uses an assign reference instead of weak which is why it crashed.
I'm having trouble to diagnostic a crash with UIScrollView
UIKit
-[UIScrollView setContentOffset:]
Exception Type: EXC_BAD_ACCESS Code KERN_INVALID_ADDRESS at 0xe0000008
com.apple.main-thread Crashed
0 libobjc.A.dylib objc_msgSend + 15
1 UIKit -[UIScrollView setContentOffset:] + 618
2 UIKit -[UITableView setContentOffset:] + 330
3 UIKit -[UIScrollView(Static) _adjustContentOffsetIfNecessary] + 1474
4 UIKit -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:tramplingDragFlags:] + 414
5 UIKit -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:] + 30
6 UIKit -[UIScrollView removeFromSuperview] + 30
7 ... UIKit -[UIView dealloc] + 296
8 UIKit -[UIView dealloc] + 296
9 libobjc.A.dylib (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 168
10 CoreFoundation _CFAutoreleasePoolPop + 16
11 CoreFoundation __CFRunLoopRun + 1296
12 CoreFoundation CFRunLoopRunSpecific + 356
13 CoreFoundation CFRunLoopRunInMode + 104
14 GraphicsServices GSEventRunModal + 74
15 UIKit UIApplicationMain + 1120
16 iTV Shows main.m line 12
I had the same problem. Setting the TableView and ScrollView delegates (or any other delegates that you might have) to nil in the dealloc method solved the problem.
- (void)dealloc {
self.tableView.delegate = nil;
self.tableView.dataSource = nil;
}
Its hard to give a concrete answer without seeing your code, but the iOS Debugging Magic technical note is always a great resource with tips for debugging crashes.
Technical Note TN2239: iOS Debugging Magic