iOS app crashing in Core Location callback machinery

2.9k views Asked by At

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!

2

There are 2 answers

1
hoha On BEST ANSWER

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.

0
David H On

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.