MapKit internal calls causing crash

Posted by Ronnie Liew on Stack Overflow See other posts from Stack Overflow or by Ronnie Liew
Published on 2010-04-06T15:16:17Z Indexed on 2010/04/07 1:53 UTC
Read the original article Hit count: 818

I have a MKMapView in the view of a UIViewController. The app will crash randomly when the I pop the UIViewController off from the UINavigationController.

In the dealloc method of the UIViewController, I have already assigned the MKMapView delegate to nil as below:

- (void)dealloc {
    mapView.delegate = nil;
    [_mapView release];
    _mapView = nil;        
    [super dealloc];
}

The crash log are also attached as follows:

Crash log #1:

Thread 0 Crashed:
0   libobjc.A.dylib                0x000026f6 objc_msgSend + 18
1   MapKit                         0x0005676c -[MKUserLocationPositionAnimation animationDidStop:finished:] + 64
2   QuartzCore                     0x00015a26 run_animation_callbacks(double, void*) + 282
3   QuartzCore                     0x000158dc CA::timer_callback(__CFRunLoopTimer*, void*) + 100
4   CoreFoundation                 0x00056bac CFRunLoopRunSpecific + 2112
5   CoreFoundation                 0x00056356 CFRunLoopRunInMode + 42
6   GraphicsServices               0x00003b2c GSEventRunModal + 108
7   GraphicsServices               0x00003bd8 GSEventRun + 56
8   UIKit                          0x00002768 -[UIApplication _run] + 384
9   UIKit                          0x0000146c UIApplicationMain + 688
10  Refill                         0x00002aea main (main.m:14)
11  Refill                         0x00002a60 start + 44

Crash log#2

    Thread 0 Crashed:
0   libobjc.A.dylib                0x000026f4 objc_msgSend + 16
1   MapKit                         0x0005a20e -[MKUserLocationViewInternal userLocationViewAccuracyDidUpdate] + 42
2   MapKit                         0x0005676c -[MKUserLocationPositionAnimation animationDidStop:finished:] + 64
3   QuartzCore                     0x00015a26 run_animation_callbacks(double, void*) + 282
4   QuartzCore                     0x000158dc CA::timer_callback(__CFRunLoopTimer*, void*) + 100
5   CoreFoundation                 0x00056bac CFRunLoopRunSpecific + 2112
6   CoreFoundation                 0x00056356 CFRunLoopRunInMode + 42
7   GraphicsServices               0x00003b2c GSEventRunModal + 108
8   GraphicsServices               0x00003bd8 GSEventRun + 56
9   UIKit                          0x00002768 -[UIApplication _run] + 384
10  UIKit                          0x0000146c UIApplicationMain + 688
11  Refill                         0x00002aea main (main.m:14)
12  Refill                         0x00002a60 start + 44

Seems like the MapKit is trying to update the MKMapView on the user location but the delegate has already been deallocated. What else I am missing here?

© Stack Overflow or respective owner

Related posts about mkmapview

Related posts about mapkit