Posted by: bearc0025 | January 5, 2010

MapKit Crash getting User Location

I started getting this crash – only on ad hoc builds – not sim, not debug device builds (from Xcode Organizer)…

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib               	0x00003ec0 objc_msgSend + 24
1   MapKit                        	0x00032960 -[MKMapView(UserPositioningInternal) locationManagerUpdatedLocation:] + 1032
2   CoreFoundation                	0x0005da0e -[NSObject performSelector:withObject:] + 18
3   CoreFoundation                	0x00062a04 -[NSArray makeObjectsPerformSelector:withObject:] + 368
4   MapKit                        	0x000028e8 -[MKLocationManager _reportLocationStatus:] + 52
5   MapKit                        	0x00004e74 -[MKLocationManager _reportLocationSuccess] + 48
6   MapKit                        	0x000049c0 -[MKLocationManager locationManager:didUpdateToLocation:fromLocation:usingSupportInfo:] + 936
7   CoreLocation                  	0x00009af4 -[CLLocationManager onClientEventLocation:] + 1132
8   CoreLocation                  	0x00008020 -[CLLocationManager onClientEvent:supportInfo:] + 140
9   CoreLocation                  	0x000081ac OnClientEventInternal + 24
10  CoreLocation                  	0x00005e48 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 1080
11  CoreFoundation                	0x00030380 __CFMessagePortPerform + 112
12  CoreFoundation                	0x00057524 CFRunLoopRunSpecific + 2296
13  CoreFoundation                	0x00056c18 CFRunLoopRunInMode + 44
14  GraphicsServices              	0x0000436c GSEventRunModal + 188

The problem seemed to be the MKMapView getting deallocated w/o remove the delegate.

I added a call to set the delegate to nil in my dealloc method and things worked.

I wonder why a) this isn’t a problem for other classes and/or b) does the IB backend handle setting other classes delegate’s to nil?

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

Join 388 other followers

%d bloggers like this: