One of the most frequent crashes of my live app is a crash at MKMapView. It crash at the internal method -[MKMapView mapTileViewDidFinishLoading:]. During my test I could not retrace the crash but is very frequent in the crash reports on iTunes Connect. Has anyboday some experience with this crash? It is only a very simple map showing exactly one annotation.
Here is the complete stacktrace of this crash:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000009
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x339737d8 objc_msgSend + 16
1 MapKit 0x345709ec -[MKMapView mapTileViewDidFinishLoading:]
2 CoreFoundation 0x344492e4 -[NSObject(NSObject) performSelector:withObject:]
3 Foundation 0x3326981e __NSThreadPerformPerform
4 CoreFoundation 0x34460f1e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
5 CoreFoundation 0x34432ba0 __CFRunLoopDoSources0
6 CoreFoundation 0x34432444 __CFRunLoopRun
7 CoreFoundation 0x34432270 CFRunLoopRunSpecific
8 CoreFoundation 0x34432178 CFRunLoopRunInMode
9 GraphicsServices 0x3026b5ec GSEventRunModal
10 GraphicsServices 0x3026b698 GSEventRun
11 UIKit 0x31ad011c -[UIApplication _run]
12 UIKit 0x31ace128 UIApplicationMain
13 MYApp 0x00002e08 main + 36
14 MYApp 0x00002dd8 start + 32
I think I may have fixed this issue in my own application. It appears that this post has the correct solution and explanation.
The message that was causing the failure in my application was 'mapViewDidFinishLoadingMap' which is a message of the MKMapViewDelegate. Try to set the mapView delegate to 'nil' before in your views dealloc method.
Just do this it will solve the problem 100%
-(void) viewWillDisappear:(BOOL)animated
{
self.mapView.delegate = nil;
mapView=Nil;
NSLog(#"viewWillDisappear");
}
I also had to set the delegate to nil in viewDidDisappear to fix the issue.
Related
I have an app which seems to work fine in debug mode, but now it's live in the app store it crashes every time. I have managed to find a crash log, which shows the following:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3238329e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3a22e97a objc_exception_throw + 26
2 UIKit 0x3451837c +[UIStoryboard storyboardWithName:bundle:] + 436
3 UIKit 0x3435a58e -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 38
4 UIKit 0x341e379c -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 524
5 UIKit 0x3418bc34 -[UIApplication handleEvent:withNewEvent:] + 1000
6 UIKit 0x3418b6c8 -[UIApplication sendEvent:] + 68
7 UIKit 0x3418b116 _UIApplicationHandleEvent + 6150
8 GraphicsServices 0x35e9659e _PurpleEventCallback + 586
9 GraphicsServices 0x35e961ce PurpleEventCallback + 30
10 CoreFoundation 0x3235816e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
11 CoreFoundation 0x32358112 __CFRunLoopDoSource1 + 134
12 CoreFoundation 0x32356f94 __CFRunLoopRun + 1380
13 CoreFoundation 0x322c9eb8 CFRunLoopRunSpecific + 352
14 CoreFoundation 0x322c9d44 CFRunLoopRunInMode + 100
15 UIKit 0x341e2480 -[UIApplication _run] + 664
16 UIKit 0x341df2fc UIApplicationMain + 1116
Does anyone know what this means? I really need to submit an update for this app quickly so I need to fix it.
One great place to start is this link:
http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs
It will show you how to read your crash log.
For instance EXC_CRASH (SIGABRT) means:
The exception code is a SIGABRT. Usually, a SIGABRT exception is raised when an object receives an unimplemented message. Or to put it in simpler terms, there’s a call for a nonexistent method on an object.
This should give you a hint as to what the problem is. It's not in your code as you can see that your classes are not called in the list to the right.
I would also say that if it doesn't work in the app store you might make sure that it works for all languages on Ad-Hoc. Maybe something is missing from your storyboard?
Check the storyboard names. Make sure you have a main storyboard selected for ipad and that the name matches.
I am using AdWhirl in my iphone app and I am displaying the adView in several different views. Each view has a different adView ivar. Problem is that when I am switching the views quickly, ASIHttpRequest within Adwhirl code tries to call the view after the view has been deallocted. I have tried setting the delegate to nil in my view but to no avail. Are there any other workarounds to cancel the AdWhirl ASIHttpRequest when the view is deallocated. In my view dealloc I am doing something like:
adView.delegate = nil;
adView = nil
where adView is an ivar declared like:
#property (nonatomic, retain) AdWhirlView *adView;
Crash Log:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000c
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x32ad5c98 objc_msgSend + 16
1 SocialMashup 0x0005503c -[ASIHTTPRequest requestReceivedResponseHeaders:] (ASIHTTPRequest.m:1954)
2 CoreFoundation 0x36387efc -[NSObject(NSObject) performSelector:withObject:] + 16
3 Foundation 0x32cfe7a2 __NSThreadPerformPerform + 262
4 CoreFoundation 0x363f1a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
5 CoreFoundation 0x363f3758 __CFRunLoopDoSources0 + 376
6 CoreFoundation 0x363f44e4 __CFRunLoopRun + 224
7 CoreFoundation 0x36384ebc CFRunLoopRunSpecific + 224
8 CoreFoundation 0x36384dc4 CFRunLoopRunInMode + 52
9 GraphicsServices 0x30cdd418 GSEventRunModal + 108
10 GraphicsServices 0x30cdd4c4 GSEventRun + 56
11 UIKit 0x3037cd62 -[UIApplication _run] + 398
12 UIKit 0x3037a800 UIApplicationMain + 664
13 ZFirewall.dylib 0x013dcb24 0x13cd000 + 64292
14 SocialMashup 0x000024ae main (main.m:17)
15 SocialMashup 0x00002444 start + 32
I'm pretty sure AdWhirl doesn't use ASIHTTPRequest at all. Maybe a particular ad network you're using does, but the logs don't even seem to point to AdWhirl as the culprit.
I received the following crash report from a user.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xf0012e8d
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3601cc98 objc_msgSend + 16
1 CoreFoundation 0x312bdc30 CFGetRetainCount
2 QuartzCore 0x30605c08 CA::release_root_if_unused(_CALayer*, _CALayer*, void*)
3 QuartzCore 0x30605bb4 x_hash_table_remove_if
4 QuartzCore 0x305e4f96 CA::Transaction::commit()
5 QuartzCore 0x305de04e CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
6 CoreFoundation 0x312fca2e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
7 CoreFoundation 0x312fe45e __CFRunLoopDoObservers
8 CoreFoundation 0x312ff754 __CFRunLoopRun
9 CoreFoundation 0x3128febc CFRunLoopRunSpecific
10 CoreFoundation 0x3128fdc4 CFRunLoopRunInMode
11 GraphicsServices 0x32478418 GSEventRunModal
12 GraphicsServices 0x324784c4 GSEventRun
13 UIKit 0x329f8d62 -[UIApplication _run]
14 UIKit 0x329f6800 UIApplicationMain
15 IW Select 0x00002b60 main + 44
16 IW Select 0x00002b28 start + 32
I'm having trouble debugging it since it doesn't look like the crash was even caused by something in my app. Does anyone know what could cause a crash like this?
If we observe the crash log, we will notice that, it was expecting some object but it was already released.(see it was calling CFGetRetainCount on the needed object to acertain that object is still alive, but it is not). Also, if we notice the frameworks then it indicates that crash could be because of some view is released or something related to it.(as it says its crashing during animation.)
0 libobjc.A.dylib 0x3601cc98 objc_msgSend + 16
1 CoreFoundation 0x312bdc30 CFGetRetainCount
2 QuartzCore 0x30605c08 CA::release_root_if_unused(_CALayer*, _CALayer*, void*)
3 QuartzCore 0x30605bb4 x_hash_table_remove_if
4 QuartzCore 0x305e4f96 CA::Transaction::commit()
5 QuartzCore 0x305de04e CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
6 CoreFoundation 0x312fca2e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
Thanks,
This might be able to help you out or at least get you started.
Debugging EXC_BAD_ACCESS Errors
Check your localization settings. Specifically, change your language settings to something other than English/your default language and see if you can reproduce the crash.
My app works great when I build and debug but when I run on its own, it crashes due to some other issues.
I have one NSObject class, one UITableView class, one UIView class , one UITableViewCell class and one NSOperation class.
Does any body have similar issues or if any one can help me out.
Application Specific Information:
objc_msgSend() selector name: release
iPhone Simulator 235, iPhone OS 4.2 (iPhone/8C134)
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x01134a67 objc_msgSend + 27
1 UIKit 0x004ab1e2 -[UITableViewCell removeFromSuperview] + 167
2 UIKit 0x003249d9 -[UIView dealloc] + 340
3 UIKit 0x0032e281 -[UIScrollView dealloc] + 341
4 UIKit 0x003661ce -[UITableView dealloc] + 1085
5 Foundation 0x000698da __delayedPerformCleanup + 59
6 CoreFoundation 0x00f4bbde CFRunLoopTimerInvalidate + 446
7 CoreFoundation 0x00fb57d7 __CFRunLoopDoTimer + 1799
8 CoreFoundation 0x00f11cc9 __CFRunLoopRun + 1817
9 CoreFoundation 0x00f11240 CFRunLoopRunSpecific + 208
10 CoreFoundation 0x00f11161 CFRunLoopRunInMode + 97
11 GraphicsServices 0x01874268 GSEventRunModal + 217
12 GraphicsServices 0x0187432d GSEventRun + 115
13 UIKit 0x002fa42e UIApplicationMain + 1160
14 Time 0x00001e08 main + 102 (main.m:14)
15 Time 0x00001d99 start + 53
This technote has the technical info on crashlogs:
http://developer.apple.com/library/mac/#technotes/tn2004/tn2123.html
However, you are having a debugging problem, not a crashlog problem.
See tips for debugging here:
http://www.cocoadev.com/index.pl?DebuggingTechniques
Interpreting crash logs takes practice. People here see this: removeFromSuperview and immediately think "Aha, a clue! this is likely a memory issue" because removeFromSuperview will remove a view then decrement it's retain count. if the retain count is already zero, then decrementing one more time may lead to a crash. Thus, they think you are over releasing your UITableViewCell
check your UITableViewCell for alloc/init, release or autorelease...
My app crashes when I do [self.navigationController popViewControllerAnimated:YES].
It crashes more on Device than on Simulator. Please suggest how to fix this?
Date/Time: 2010-11-09 10:51:41.325 +0800
OS Version: iPhone OS 4.0.1 (8A306)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000286e objc_msgSend + 18
1 CoreFoundation 0x00002c30 -[NSObject(NSObject) release] + 24
2 libobjc.A.dylib 0x00003c1a objc_setProperty + 114
3 UIKit 0x000693d4 -[UINavigationController setDisappearingViewController:] + 24
4 UIKit 0x0007d5c0 -[UINavigationController _clearLastOperation] + 40
5 UIKit 0x0007d4b4 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 556
6 UIKit 0x0007d248 -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] + 204
7 UIKit 0x0007d0b6 -[UINavigationTransitionView _navigationTransitionDidStop] + 450
8 UIKit 0x00059974 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
9 UIKit 0x0005987e -[UIViewAnimationState animationDidStop:finished:] + 34
10 QuartzCore 0x000127ba run_animation_callbacks(double, void*) + 286
11 QuartzCore 0x0001265c CA::timer_callback(__CFRunLoopTimer*, void*) + 116
12 CoreFoundation 0x00071a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
13 CoreFoundation 0x00073ede __CFRunLoopDoTimer + 854
14 CoreFoundation 0x0007485e __CFRunLoopRun + 1082
15 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
16 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
17 GraphicsServices 0x000036e8 GSEventRunModal + 108
18 GraphicsServices 0x00003794 GSEventRun + 56
19 UIKit 0x000062a0 -[UIApplication _run] + 396
20 UIKit 0x00004e10 UIApplicationMain + 664
21 tenpay 0x00006124 main (main.m:13)
22 tenpay 0x00002324 start + 44
myviewcontroller = [[[MyViewController alloc]init]autorelease];
[self.navigationController pushViewController:myviewcontroller animated:YES];
[myviewcontroller release]; //This is my bug !!! I just fixed it.
This usually means you are sending a message to a released object which is a bad idea.
From the stack you can see that it is sending a release message to an object. I'd suggest that the object has already been released and thus hasa retain count of 0. Therefore a further release would be invalid.
I believe if you turn on a flag, I think it's called Zombie detection or something like that, then any message to a released object will generate a more descriptive message.
Perhaps a more experienced developer can jump in here with more details.
Yes, I believe Derek is pointing you in the right direction. Could you possibly list what kind of memory-related operations you are performing on the active controller before sending this release message (the release message is being sent implicitly when you try to pop it out). Please clarify if you are using autorelease for this controller,etc... Also it might be helpful to see what are the associated properties that you may have associated with this controller (ex: #property(nonatomic, retain, etc...)) if there are any.