10

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 
AlexVogel
  • 10,601
  • 10
  • 61
  • 71

3 Answers3

11

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.

Community
  • 1
  • 1
matheeeny
  • 1,714
  • 2
  • 17
  • 32
  • Thank you for your answer. Your are right. I didn't set the delegate to nil before release the map. I will try this and inform you about any news. – AlexVogel Nov 03 '10 at 09:30
  • OK now 1 month after implementing the solutions and no new bug reports an can say this works. – AlexVogel Dec 20 '10 at 15:29
2

Just do this it will solve the problem 100%

-(void) viewWillDisappear:(BOOL)animated
{
    self.mapView.delegate = nil;
    mapView=Nil;
    NSLog(@"viewWillDisappear");

}
Miguel-F
  • 13,450
  • 6
  • 38
  • 63
0

I also had to set the delegate to nil in viewDidDisappear to fix the issue.

ileitch
  • 532
  • 4
  • 12