I have problems analyzing my crashlog. The iPhone crashes sometimes, when I click on the app icon to start the app. The app is already "running" in background, but it's not active. This is the symbolized crash log:
Thread 0 Crashed:
0 libobjc.A.dylib 0x33479470 objc_msgSend + 28
1 CoreLocation 0x3436f68e -[CLLocationManager onClientEvent:supportInfo:] + 98
2 CoreLocation 0x3436f804 OnClientEvent + 16
3 CoreLocation 0x3436b522 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
4 CoreLocation 0x3436cf74 CLClientHandleDaemonDataRegistration(__CLClient*, CLDaemonCommToClientRegistration const*, __CFDictionary const*) + 668
5 CoreLocation 0x3436d4c8 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 212
6 CoreFoundation 0x33a813fe __CFMessagePortPerform + 242
7 CoreFoundation 0x33a556f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
8 CoreFoundation 0x33a556bc __CFRunLoopDoSource1 + 160
9 CoreFoundation 0x33a47f76 __CFRunLoopRun + 514
10 CoreFoundation 0x33a47c80 CFRunLoopRunSpecific + 224
11 CoreFoundation 0x33a47b88 CFRunLoopRunInMode + 52
12 GraphicsServices 0x33b0e4a4 GSEventRunModal + 108
13 GraphicsServices 0x33b0e550 GSEventRun + 56
14 UIKit 0x32099322 -[UIApplication _run] + 406
15 UIKit 0x32096e8c UIApplicationMain + 664
16 Norddeich 0x00002764 main (main.m:14)
17 Norddeich 0x00002718 start + 32
As far as i understand the stack trace, the error occurred in the main.m. Line 14 is part of the default code:
int retVal = UIApplicationMain(argc, argv, nil, nil);
Please give me a hint, how to find the error.
Thank you in advance!
Do you set it's delegate to nil before returning from controller (or at least in controller's dealloc)? I suspect CLLocationManager is trying to send a message to delegate which is deallocated already - that's why it crashes at obj_msgSend.
I had this same problem testing my app on 4.3, but not in 5.0. The issue was that I was trying to dealloc the CLLocationManager inside one of the delegate methods. It works fine in 5.0, but crashes a iPhone 3GS running 4.3 every time.
In the end I made the CLLocationManager object a property, then in the delegate method set the delegate to nil and dispatched a block to the main thread to release the object.
Related
My app (named MyLittleApplication) crashes randomly when I click on a button that pops view controller.
I could use some help (to find out where should I start looking) with crash log:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x600332e0
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x351faf78 objc_msgSend + 16
1 Foundation 0x37d0a74c NSKVOPendingNotificationCreate + 216
2 Foundation 0x37d0a652 NSKeyValuePushPendingNotificationPerThread + 62
3 Foundation 0x37cfc744 NSKeyValueWillChange + 408
4 Foundation 0x37cd3848-[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 176
5 Foundation 0x37d55a14 _NSSetPointValueAndNotify + 76
6 UIKit 0x311f825a -[UIScrollView(Static) _adjustContentOffsetIfNecessary] + 1890
7 UIKit 0x31215a54 -[UIScrollView setFrame:] + 548
8 UIKit 0x31215802 -[UITableView setFrame:] + 182
9 POViO 0x000fcac8 0xf8000 + 19144
10 UIKit 0x31211b8e -[UIViewController _setViewAppearState:isAnimating:] + 138
11 UIKit 0x3126b8a8 -[UIViewController beginAppearanceTransition:animated:] + 184
12 UIKit 0x3121490c -[UINavigationController _startTransition:fromViewController:toViewController:] + 832
13 UIKit 0x312144fc -[UINavigationController _startDeferredTransitionIfNeeded] + 244
14 UIKit 0x3125e8e4 _popViewControllerNormal + 184
15 UIKit 0x3125e712 -[UINavigationController _popViewControllerWithTransition:allowPoppingLast:] + 386
16 UIKit 0x31242bba -[UINavigationController popToViewController:transition:] + 626
17 POViO 0x001074e6 0xf8000 + 62694
18 CoreFoundation 0x374553f6 -[NSObject performSelector:withObject:withObject:] + 46
19 UIKit 0x311eae00 -[UIApplication sendAction:to:from:forEvent:] + 56
20 UIKit 0x311eadbc -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24
21 UIKit 0x311ead9a -[UIControl sendAction:to:forEvent:] + 38
22 UIKit 0x311eab0a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 486
23 UIKit 0x311eb442 -[UIControl touchesEnded:withEvent:] + 470
24 UIKit 0x311e9924 -[UIWindow _sendTouchesForEvent:] + 312
25 UIKit 0x311e9312 -[UIWindow sendEvent:] + 374
26 UIKit 0x311cf68e -[UIApplication sendEvent:] + 350
27 UIKit 0x311cef34 _UIApplicationHandleEvent + 5820
28 GraphicsServices 0x33c11224 PurpleEventCallback + 876
29 CoreFoundation 0x374cf51c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
30 CoreFoundation 0x374cf4be __CFRunLoopDoSource1 + 134
31 CoreFoundation 0x374ce30c __CFRunLoopRun + 1364
32 CoreFoundation 0x3745149e CFRunLoopRunSpecific + 294
33 CoreFoundation 0x37451366 CFRunLoopRunInMode + 98
34 GraphicsServices 0x33c10432 GSEventRunModal + 130
35 UIKit 0x311fdcce UIApplicationMain + 1074
36 MyLittleApplication 0x000f90ae 0xf8000 + 4270
37 MyLittleApplication 0x000f9048 0xf8000 + 4168
I suspect that it has something to do with notificationCenter and UIDeviceOrientationDidChangeNotifications I use. Is this true or am I looking in the wrong direction?
I am calling
[notificationCenter removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]
in viewDidUnload, this shuld be enough?
Can you please tell me what bug should i start looking for?
This is a stacktrace you see the stack of methods called when the crash happened.
You start at the bottom and work yourself up to the top and search for a method call from your app (the stacktrace includes calls from the frameworks too (e.g. -[UIScrollView(Static) _adjustContentOffsetIfNecessary])).
The topmost method call from your app is likely the cause of your error and you can see what the system tried afterwards.
In your case it seems that you call popToViewController and the iOS frameworks try to animate the transition from one UIViewController to the next. There seems to be a problem for the table view to set its frame and scroll to the contentOffset.
This is likely to be caused by a memory error. You get this hint by examining Exception Type: EXC_BAD_ACCESS (SIGSEGV)
EXC_BAD_ACCESS is likely a hint that you try to acces a something which is no more in the memory -> already released.
In general I would recomment to activate exveption breakpoints in Xcode:
Have you set the exception breakpoint?
got to breakpoint editor pane
click on the x in the bottom left corner
choose add exception breakpoint
Now you should see a stacktrace if an exception occurs. And Xcode should be at the line where the crash happens.
The second thing you should get familiar with is the zombie mode in Instruments.
You can find a good introduction to the zombi mode in this video.
In your case, you can see you have a EXC_BAD_ACCESS (SIGSEGV). This means you're trying to access something which isn't here, or at least was here but isn't anymore. If you can replicate the error, try using the Zombies mode of Instruments, it will tell will which thing it was expecting to access. The solution to this problem is often that you released the resource too early a resource you still need.
You might want to throw some NSLog statements in the methods just so you can have an idea of where things are going wrong. Sometimes those iOS messages can be a little cryptic.
Hullo,
I am experimenting a very vicious crash that shows up in the following way in the device logs:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x50000008
Crashed Thread: 0`
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x33b24c98 objc_msgSend + 16
1 Foundation 0x3429465a _NSURLConnectionReleaseClient + 30
2 CFNetwork 0x355ac608 ClientContextHolder<CFURLConnectionClient_V4>::forget() + 20
3 CFNetwork 0x355ac5ea URLConnectionClient::releaseClientLocked() + 34
4 CFNetwork 0x355a0e9a URLConnectionClient::processEvents() + 170
5 CFNetwork 0x355a0de2 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
6 CFNetwork 0x355a0d54 MultiplexerSource::perform() + 120
7 CFNetwork 0x355a0cd2 MultiplexerSource::_perform(void*) + 2
8 CoreFoundation 0x3039ca72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
9 CoreFoundation 0x3039e758 __CFRunLoopDoSources0 + 376
10 CoreFoundation 0x3039f4e4 __CFRunLoopRun + 224
11 CoreFoundation 0x3032febc CFRunLoopRunSpecific + 224
12 CoreFoundation 0x3032fdc4 CFRunLoopRunInMode + 52
13 GraphicsServices 0x35571418 GSEventRunModal + 108
14 GraphicsServices 0x355714c4 GSEventRun + 56
15 UIKit 0x358c7d62 -[UIApplication _run] + 398
16 UIKit 0x358c5800 UIApplicationMain + 664
17 inArrivo 0x000023ca main (main.m:14)
18 inArrivo 0x00002394 start + 32
After having enabled NSZombie I also have a crash on the compiler log of the following form:
2011-05-09 16:12:24.400 inArrivo[5019:707] * -[NSURLConnection releaseDelegate]: message sent to deallocated instance 0x5d61670
appearing on the app main with the last NSLog comeing from a function with no url connections. Also if I remove some pieces of very innocent code from that function, no crash occurs, and the same happens when I run the complete application on the simulator.
Could someone give me some hints about what I may do to locate the piece of code producing the crash? Normal debugging of course is of little help here.
Thanks,
Fabrizio Bartolomucci
The message indicates that the delegate for NSURLConnection was deallocated. I would suggest you check the delegate object to see if you are doing an extra release on it.
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.
I am trying to figure out what is causing this crash. I have built and given the app to our testers but we cannot seem to reproduce this reliably. It just happens sometimes...
Thread 0 Crashed:
0 libobjc.A.dylib 0x000027da objc_msgSend + 18
1 Foundation 0x00032896 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 62
2 Foundation 0x00032818 _NSURLConnectionDidFinishLoading + 72
3 CFNetwork 0x00010dd8 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 160
4 CFNetwork 0x00004ad4 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 96
5 CFNetwork 0x000049c4 URLConnectionClient::processEvents() + 64
6 CFNetwork 0x00004976 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
7 CFNetwork 0x000048f4 MultiplexerSource::perform() + 120
8 CFNetwork 0x00004872 MultiplexerSource::_perform(void*) + 2
9 CoreFoundation 0x00055f1e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
10 CoreFoundation 0x00027ba0 __CFRunLoopDoSources0 + 376
11 CoreFoundation 0x00027444 __CFRunLoopRun + 224
12 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
14 GraphicsServices 0x000045ec GSEventRunModal + 108
15 GraphicsServices 0x00004698 GSEventRun + 56
16 UIKit 0x0000411c -[UIApplication _run] + 396
17 UIKit 0x00002128 UIApplicationMain + 664
18 myapp 0x000020d8 main (main.m:14)
19 myapp 0x0000208c start + 32
Any advice would be greatly appreciated. The app is built in XCode 3.2.4 using SDK 4.1.
Cheers...
I would try turning on NSZombieEnabled and see if that sheds any light on the issue. Is the delegate for the connection still around and valid?
Ben has some sound advice. Turn NSZombieEnabled to on.
I can tell you with almost 100% certainty that it is crashing because you have a nil object when the delegate is attempting to send it a message.
The fact that it is only crashing sometimes, tells me that you are probably using autorelease. Autorelease never decrements the retain count at exactly the same time, so sometimes your object will still be alive when it gets a delegate message and the app works. However, sometimes that object will have been released and the app crashes.
I am working on an app that tracks a users location. After about 20 minutes it seems that the app always crashes, and I am not sure why. Device logs show:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x069f6000
Crashed Thread: 0
Thread 0 Crashed:
0 Ride 0x00012e00 -[Route addCoordinate:] (Route.m:92)
1 Ride 0x0000877a -[MyRidesMapViewController locationManager:didUpdateToLocation:fromLocation:] (MyRidesMapViewController.m:528)
2 CoreLocation 0x0000931c -[CLLocationManager onClientEventLocation:] + 584
3 CoreLocation 0x00007552 -[CLLocationManager onClientEvent:supportInfo:] + 98
4 CoreLocation 0x000076a0 OnClientEvent + 16
5 CoreLocation 0x00002ade CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
6 CoreLocation 0x0000512c CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 204
7 CoreLocation 0x0000528a CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 298
8 CoreFoundation 0x0006936a __CFMessagePortPerform + 242
9 CoreFoundation 0x00071aa4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
10 CoreFoundation 0x00073848 __CFRunLoopDoSource1 + 160
11 CoreFoundation 0x00074626 __CFRunLoopRun + 514
12 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
14 GraphicsServices 0x000036e8 GSEventRunModal + 108
15 GraphicsServices 0x00003794 GSEventRun + 56
16 UIKit 0x000062a0 -[UIApplication _run] + 396
17 UIKit 0x00004e10 UIApplicationMain + 664
18 Ride 0x00002a20 main (main.m:14)
19 Ride 0x000029d4 start + 32
Looks like I am trying to release something that has already been released, but what?! I have NSZombie enabled, and it does not seem to help.
It used to work, and I recently updated my class to use self. for anything that I synthesized, could this be the issue?
EDIT: I updated the error. It seems to be listing the line numbers for each line, but they do not seem to be helping to find the issue.
Do you have NSZombie enabled while you're running on the device? If so chances are you are running out of memory. As you know, NSZombie keeps released objects around so you can detect a double release.
Chances are you do have some memory issues though. Does the static analyzer show you anything? (shift-command-A).
Setting the location manager delegate to nil AND THEN releasing it fixed the crash for me.